In the last couple of days I had to deal with these number for a MSDB db hasn't purged since 3 years !!!! yeah 3 years , so I had to do many tasks out of the normal tasks ,
let me give you brief about the figures
the fact is , if you start purging the historical backup data you will not be able to perform any type of backup operations for hours if it hasn't take days , in addition to growth of the log file of MSDB dbs , so I had a practical experience I would like to share to do so in a very smooth way as following :
Create index IX_backupmediaset_media_set_id on backupmediaset(media_set_id)
go
Create index IX_backupmediafamily_media_set_id on backupmediafamily(media_set_id)
go
CREATE NONCLUSTERED INDEX [IX_pro_Del]
last step start delete per database
EXEC sp_delete_database_backuphistory 'you database Name'
GO
once you reach a reasonable number of transactions in above listed tables you can get back to normal operation and delete by date
what you have done on the test instance can be applied to your production without any interruption to your operation (backup and size of log file)
let me know if anything goes wrong ... Enjoy :)
let me give you brief about the figures
- backupFile --- 10 Million rows
- backupFilegroup --- 6 Million rows
- backupmediafamily--- 4 Million rows
- backupmediaset--- 4 Million rows
- backupset--- 4 million
the fact is , if you start purging the historical backup data you will not be able to perform any type of backup operations for hours if it hasn't take days , in addition to growth of the log file of MSDB dbs , so I had a practical experience I would like to share to do so in a very smooth way as following :
- extract the whole data in the list of tables above to another SQL instance plus these tables
- restorefile
- restorefilegroup
- restore history
Create index IX_backupmediaset_media_set_id on backupmediaset(media_set_id)
go
go
ON [dbo].[backupset] ([database_name])
INCLUDE ([backup_set_id])
GO
CREATE NONCLUSTERED INDEX []
ON [dbo].[backupset] ([database_name])
INCLUDE ([media_set_id])
GO
EXEC sp_delete_database_backuphistory 'you database Name'
GO
once you reach a reasonable number of transactions in above listed tables you can get back to normal operation and delete by date
what you have done on the test instance can be applied to your production without any interruption to your operation (backup and size of log file)
let me know if anything goes wrong ... Enjoy :)
No comments:
Post a Comment