Tuesday, March 20, 2012

restoring msdb

I need some data from msdb.dbo.sysjobs and msdb.dbo.sysjobhistory but I need it from a backup file.

I don't need to restore the msdb database, I just need some data from the backup. Everytime I try to restore it under some innocuous name like bills_db it tells me msdb is in use.

Is there a way to restore this db to some other name and retrieve data from it?I never really had to do this but I imagine your sql server is getting pissed because you are trying to restore over the current msdb.

if I was you, I would create a blank database named something other than msdb and look at the WITH REPLACE argument of the RESTORE statement in books online.|||Rather that WITH REPLACE, look at WITH MOVE:

restore database msdb_copy from disk = '<disk location>' WITH
MOVE 'MSDBData' to '<different physical file name>.mdb'
,MOVE 'MSDBLog' to '<different physical file name>.ldf'
,stats

No comments:

Post a Comment