el

Recovering the Master Database in SQL 2008/2012 Environment

Friday, April 21, 2017

If the master database is corrupt or damaged, SQL Server will not start. Attempting to start SQL Server will have no effect. Attempting to connect to the instance with Management Studio will invoke a warning that the server does not exist or that access is denied. The only solution is to first rebuild the master database using the command-line setup (as shown next), reapply any SQL Server updates, start SQL Server in single-user mode, and restore the master database.

  1. Rebuild the master database using the following command-line setup:

setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=”” /SQLSYSADMINACCOUNTS=”<DomainName\UserName >” /SAPWD=””

  • exe is either from your original installation media or the ‘‘local’’ setup.exe as found in the 100\Setup Bootstrap\Release directory.
  • The /QUIET switch suppresses all error messages.
  • The /ACTION=REBUILDDATABASE switch rebuilds all the system databases.
  • The /INSTANCENAME switch specifies the name of your SQL Server named instance. Use MSSQLServer for ‘‘_<instance_name>_’’ for the default instance.
  • The /SQLSYSADMINACCOUNTS switch corresponds to the currently logged in domain user running this rebuild process. The user must be a member of the SQL Server instance’s sysadmin server role.
  • The /SAPWD switch is used to indicate a new SA password if you configured SQL Server for mixed authentication.
  1. Run the following from the command prompt to start a default instance of SQL Server in single-user mode:

sqlservr.exe -m To start a named instance of SQL Server in single-user mode, run the following: sqlservr.exe -m -s

  1. Reapply any SQL Server updates, service packs, and hot fixes that were previously applied to the SQL Server.
  2. Restore the master database as you would a user database.

Note: Rebuilding the master database rebuilds the msdb and model databases too, so after rebuilding the databases restore the system databases (master, msdb, model) from the most recent good backup.

No items found.