Restore Master Database

Sometimes, you need to restore the master database. Restoring master db is different than other user databases. I followed the below instructions while doing the restore .
1.Set the server in single user mode. This can be done by adding -m to the startup parameters in the configuration manager(right click on the sql service and go to properties) and restart the sql server.
2.Disable the sql server agent.
3.Go to command prompt and connect to the sql server as SQLCMD -E.If your windows account has sysadmin rights on the server, you can get through it else, specify the credentials. Also, if it is not the default instance, you will need to mention the servername\InstanceName.
Example : SQLCMD -S SERVERNAME\INSTANCE -U LOGINNAME -P MYPASSWORD
4.After connecting to the server, you can run the below
RESTORE DATABASE MASTER FROM DISK = ‘E:\BACKUPPATH\BACKUPFILE.BAK with REPLACE’
This will replace the master database with your backup copy. There are couple of other ways to do but I find this one easy to deal in these scenarios. As a tip one other option is using DAC(Dedicated Admin Connection).