Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.