Deletes the entries in the backup and restore history tables for backup sets that are older than oldest_date. Because additional rows are added to the backup and restore history tables whenever a backup or restore operation is performed, sp_delete_backuphistory can be used to reduce the size of the history tables in the msdb database.
sp_delete_backuphistory [@oldest_date =] 'oldest_date'
0 (success) or 1 (failure)
None
sp_delete_backuphistory must be run from the msdb database.
Execute permissions default to members of the sysadmin fixed server role, but can be granted to other users.
This example deletes all entries older than August 20, 1998, 5:30 A.M., in the backup and restore history tables.
USE msdb
EXEC sp_delete_backuphistory '08/20/98'
BACKUP | LOAD |
backupfile | RESTORE |
backupmediafamily | restorefile |
backupmediaset | restorehistory |
backupset | SQL Server: Buffer Manager Object |
DUMP | SQL Server: Cache Manager Object |