How to restore the MASTER database

  1. The MASTER database is a different beast from all the other databases.
  2. The MASTER database stores the logins and the lists of all of your databases.
  3. Without the MASTER database, you can't start SQL Server.
  4. It must be done in single user mode.

Applies to:

  • Microsoft SQL Server 2005

Steps

  • Stop SQL Server & SQL Agent
  • Restart SQL Server in single user mode:
"\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\BINN\sqlservr.exe" -m
Restore
Single user mode
  • Start a DOS box:
C:\> sqlcmd
1> restore database master from DISK = 'C:\temp\master-20070822-02.bak';
2> go
Restore
Restore the master database

Rebuild the MASTER database if corrupted

The REBUILDM.EXE utility has been removed from MSSQL 2005. If the MASTER database is corrupted, you will need to use the setup.exe on the installation CD to rebuild system databases. REBUILDM.EXE is now part of setup program.