Home > Backup and Recovery > Recovering the master database in SQL 2008 environment

Recovering the master database in SQL 2008 environment


If the master database is corrupted or damaged, SQL Server won’t 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=”<instance name>”

/SQLSYSADMINACCOUNTS=”<DomainName\UserName >” /SAPWD=”<password>”

■ setup.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.

2. 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 <instancename>

3. Reapply any SQL Server updates, service packs, and hot fixes that were previously applied to the SQL Server.

4. 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.

Advertisements
Categories: Backup and Recovery
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: