tags:

views:

141

answers:

1

I am trying to hack opening a MDF file in a new database. We lost the backup.

After reading numerous articles, I came to the point where the only thing that separates me from a successful solution is setting the db into a single user mode.

I issue "sp_dboption 'MyDbName',single,true" SQL Server reports that "The command(s) completed successfully."

Then I run "DBCC CHECKDB ('MyDbName',REPAIR_ALLOW_DATA_LOSS)"

and it complains that "Repair statement not processed. Database needs to be in single user mode."

This is frustrating to no end. It's like an intentional convoluted torture by MSFT developers.

I am not a DB admin, I am a programmer that needs to make this database restored, at least the stored procedures that we lost.

Thanks for your help!

+1  A: 

You could try getting into single user mode by using the -m switch on the command line, as opposed to your sp_dboption command:

http://msdn.microsoft.com/en-us/library/aa178018(SQL.80).aspx

Chris
OK, did that, now a new error:Could not run BEGIN TRANSACTION in database 'MyDbName' because the database is in bypass recovery mode.
Dude, thank you so much! It did work despite the error, I got my db back!
I'm stoked that it worked out for you :)
Chris