Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This runs as a weelky Maintanace Plan but I am not sure what it actually does. Any clues?

declare @dt datetime 
select @dt = getdate()-30
exec msdb.dbo.sp_delete_backuphistory @dt
EXEC msdb.dbo.sp_purge_jobhistory  @oldest_date=@dt
EXECUTE msdb..sp_maintplan_delete_log null,null,@dt
share|improve this question
up vote 1 down vote accepted

These are good practice jobs to clean up old database information older than 30 days. It's normally done prior to backup or other quiet period but can be at any time.

Cleaning Jobhistory removes stored history of SQL Server jobs that have executed. Cleaning backuphistory removes old records from backup/restore history. Cleaning maintplan history may also reduce database storage by clearing maintenance plan logs, if you're using them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.