Clean backup history

  • Hi all,

    I created a full, differential and transaction log backup schedules using MSSMS. To do so, I created the tasks and scripted them to SQL sever agent jobs and scheduled as I needed. In addition, I wanted to create a clean backup history job that will run under the context of SQL Server agent job schedule. I did this using the maintenance plan wizard, but the clean up job fails. I there a way to do clean up task plan in SSMS or I have to write a T-SQL statement?

    Tanks for your hint.

    Niyala

  • Try following

    --To delete backup history of all databases before '2007-07-07'

    USE msdb

    sp_delete_backuphistory '2007-07-07'

    GO

    --To delete backup history of a specific database

    USE msdb

    sp_delete_database_backuphistory 'pubs'

    GO

    DBDigger Microsoft Data Platform Consultancy.

  • I've often found the history information to be useful. Why do you want to delete it ?

Viewing 3 posts - 1 through 2 (of 2 total)

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