Orphaned records in msdb..backupset

  • When I run the following stmt I get a list that includes some databases that no longer exist and had been deleted at some point.

    select database_name, count(*)

    from msdb.dbo.backupset

    group by database_name

    order by database_name

    What's the best way to clean this up? There are enough "orphaned" records that I would think it would be effecting performance.

    Should I just ignore this?

  • No worries if msdb database size is under control. I think somebody didn't check the deleting backup and history option while dropping

    database from enterprise manager.

    Manu Jaidka

  • Great, that does sound reasonable. I did see some advice on another post about using SP_DELETE_BACKUPHISTORY to remove old records so I'm going to investigate doing that. I'm definately being overly concerned for this particular instance, but I'm going to look at it as a learning experince too.

    ...thanks again

  • Hope you find this useful:

    http://www.sqlservercentral.com/Forums/Topic187917-5-1.aspx#bm200951

    Manu

  • Just in case someone else reads this, I found a system sp to do what I'm trying to do.

    exec msdb..sp_delete_database_backuphistory 'dbname'

    This works best for me as I'm trying to remove all the history for a particular DB.

    ...thanks again for the help.

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

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