Full System Recovery of SQL Server: Rebuilding the Master Database (Quick Rebuild)

The master database can be rebuild using SQL Server or SQL Server Express.

Before You Begin

Complete the following task:

Rebuilding the Operating System

Procedure

If the Master Database Exist

  1. Insert the SQL Server installation media into the disc drive. If you are using SQL Server Express, download the Express kit and extract the contents to a local directory.
  2. From the command prompt, navigate to the disc drive or the extracted directory and run the command for rebuilding the master database.

    For SQL 2005:

    start /wait setup.exe /qn INSTANCENAME=<InstanceName> REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=<NewStrongPassword> REINSTALLMODE=vomus

    where:

    /qn = suppresses all setup dialog boxes and error messages.

    /qb = allows display of basic setup dialog boxes and error messages.

    For SQL 2008:

    Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName /SQLSYSADMINACCOUNTS=accounts [ /SAPWD=StrongPassword ] [ /SQLCOLLATION=CollationName ]

    where:

    /QUIET or /Q = setup runs without any user interface.

  3. From the command prompt, run Services.msc
  4. Right-click the SQL Server instance and select Start.

If the Master Database Does Not Exist

In case when the master database is not available, use the following steps to rebuild the master database:

  1. Navigate to the directory where the SQL Server is installed, usually C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL.
  2. Open the Template Data folder and verify that there is a copy of the system databases created automatically during the original install.
  3. Copy the missing files and paste them into the Data directory (C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data).

    Note: Ensure that the default filters for SQL are not added, as these filters can cause the necessary files to get excluded. For more information on the default SQL filters, see Microsoft SQL Server, Content, Filters, and Regular Expressions - Best Practices.

  4. From the command prompt, run Services.msc
  5. In the Services window, right-click the SQL Server instance and select Start.

What To Do Next

After you rebuild the master database, use the steps in Restoring the SQL Server Instance to restore the data.