1

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
William
  • 1,158
  • 8
  • 9
Andy
  • 199
  • 1
  • 6

1 Answers1

2

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.

William
  • 1,158
  • 8
  • 9