I am trying to restore master DB from a backup and getting below error:
To restore the master database, the server must be running in single-user mode. For information on starting in single-user mode, see "How to: Start an Instance of SQL Server (sqlservr.exe)" in Books Online.
I thought it would be simple however I have tried three different approach to meet the requirement but none of them worked.
First I used
right click on master DB > Tasks > Restore > Database.
And check Close existing connections to destination database after selecting the backup.
It returns me with below:
System.Data.SqlClient.SqlError: Option 'SINGLE_USER' cannot be set in database 'master'. (Microsoft.SqlServer.SmoExtended)
So I searched a bit and found an instruction from Microsoft
But after I added the startup parameter with -m and restarted the
I still got the first error message while I was trying to restore master by
RESTORE DATABASE master FROM DISK='C:\...\master.bak' WITH REPLACE;
My last attempt was to launch SQL Server service by
net start MSSQLSERVER /m
Then connect it by sqlcmd and send my restore by it, like
sqlcmd -S localhost
And execute the restore cmd in dos command window.
Unfortunately, this also threw the first error message. It seems all operations above didn't really turn the SQL Server in single user mode for me.
Don't know which part I am doing wrong or what should I do next.