Delete records from backupfile, backupmediafamily system tbs

  • We have backed up the database using maintenance plan for years.  The physical backup files are deleted after copied to the tape. 

    I was auditing the history tables, and found out there are some 2 years data  in the msdb..backupfile, backupmediafamily, backupmediaset and backupset tables.   Can I execute DELETE command to remove these records without harming the integrity of the msdb database?

    Thanks.. Jenny

     

     

     

     

  • Are you running that much out of space??

  • You could try "sp_delete_backuphistory". It's in BOL

  • I currently run a job monthly to cleanup the backup history with the following. I schedule the job and add a log just for verification.

    Runs under MSDB

    set nocount on

    PRINT 'Record Count before Cleanup'

    select count(*) from backupfile

    DECLARE @Oldest_date DateTime

    SELECT     @oldest_date = (select getdate() -60  as 'datetime')

    EXECUTE sp_delete_backuphistory @Oldest_date

    PRINT 'Record Count After Cleanup'

    select count(*) from backupfile

     


    Deborah Talley

  • Thank a buch!! I got too many old records, it took a long time to delete.

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply