How to restore Master DB in SQL 2005?
Thanks,
Mark
Thanks,
Mark
You need to first start SQL Server in single user mode (or put it in single user mode), and then restore your database. So using -m should work if you can get in via Management Studio (assuming no one else gets in before you).
Have you also tried using T-SQL's RESTORE DATABASE command?
Thanks for the reply Allan.
How do suggest I start SQL in single user mode.
I tried running the sqlsrvr.exe with the /m switch from the command line, but then Management Studio wouldn't connect.
I then tried starting the sqlserver service from the windows services gui, using the /m parameter, but then in Management Studio "Master" wasn't in the list of databases that I could choose from when I selected the 'restore' task. I tried typing 'master' in the selection box and then ran the restore, but it failed.
Any ideas?
I would use the command
NET START "MSSQLSERVER" /m
Connect with either SQLCMD or management studio, and use the TSQL command:
USE masterGO
RESTORE DATABASE master
FROM TAPE = '\\.\Tape0'
GOObviously substituting your backup device/file as appropriate. See Books Online for specifics.
Unfortunately the NET START "MSSQLSERVER" /m command does not work for me.
However, I can add "-m" to the Startup parameters in the SQL Server service from the Services GUI and it starts in single-user mode. I was having trouble connecting to a query window in Management Studio, when it hit me that there were still other SQL Services running. I think that one of the other services was getting to the one connection that was available before I could open a query.
So I stopped ALL SQL related services, started in "-m" single user mode, and was able to open a query and restore the master database.
It's always the little things.