question

Therealist avatar image
Therealist asked

My database switched to master DB

I have recovered one of my databases from suspect mode successfully,at the final stage i saw the result that says "database switched to Master database" since then what ever the operations that occurring on the recovered database are reflecting on Master database, for instance if i create a table under the recovered DB i am seeing that table saved in Master DB, so i am wondering how to make the recovered database work normally as it was before crashing like other user databases Thanks in advance
mastersuspectdatabase-state
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
zippy1981 avatar image
zippy1981 answered
Truely odd. First of all, do a `select * from sys.databases` and a `select * from sys.databases_files` in both master and the database your restored and post that in your questions. The second thing I'd check for is what are the command line options of the sqlservr.exe process. The third thing I would do is look for clues in `mssqlsystemresource.mdf`. That is the "secret database" in the binn folder that can only be accessed via the DAC connection in single user mode. I don't see where in mssqlsystemresource the location of master is stored, but its probably there and its possible you might be able to change it with just an `update` query. Finally, as an aside, when you screw around with the internals of SQL Server, you should be aware [OrcaMDF]( https://github.com/improvedk/OrcaMDF) exists. Its basically a readonly offline mdf viewer, and it is awesome.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.