Steps to Rebuild System Databases in SQL Server 2008

The worst has happened! An unexpected shutdown of SQL Server 2008 database server has resulted in crashing of the SQL Server. I was unable to connect to SQL Server Instance and when I checked the SQL Server error logs, I could see the following entries “Restore the database from a full backup, or repair the database”, “Cannot recover the master database”. Now what do I do? I don’t have backups of SQL Server System databases!

The questions which came to my mind were:-

  1. How can I bring the server back online at the earliest?
  2. Do I need to uninstall and then reinstall the SQL Server 2008?

Today I realized how important it is to backup system databases across environments.

Error Messages in SQL Server Error Logs

During redoing of a logged operation in database ‘master’, an error occurred at log record ID (206:424:1). Typically, the specific failure is previously logged as an error in the Windows Event Log service. Restore the database from a full backup, or repair the database.

Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.

Since I don’t have the system databases backups, the only option left for me was to rebuild the system databases in SQL Server 2008. So let’s go for it!

  • If you have SQL Server 2008 Installation media available then insert the same into the disk drive and search for Setup.EXE file or else search for Setup.EXE file which will be available locally on your server. The default location of Setup.EXE file on your server will be C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Release.

Steps to Rebuild System Databases in SQL Server 2008

  • Right click Command Prompt and select Run as administrator as shown in the below snippet to open up command prompt with elevated administrative privileges.

Important Note: The command prompt must be run under Administrator privileges to successfully rebuild the system databases.

  • In the command prompt window you need to enter the below mentioned command with appropriate values for each parameter and press enter to rebuild the system databases.
  /SQLSYSADMINACCOUNTS=accounts [/SAPWD= StrongPassword][/SQLCOLLATION=CollationName] 

Steps to Rebuild System Databases in SQL Server 2008

If you want to change the server level collation then specify collation value for /SQLCOLLATION parameter. As /SQLCOLLATION is an optional parameter, if it is not specified then the current server collation is used to rebuild the system databases.

  1. Once the setup has successfully completed rebuilding the system databases it will return to command prompt and will mention the SQL Server Build Number as shown in the snippet below. In case if there are any syntax related or permission issues then the specific error message will be displayed within the command prompt window. You need to fix those issues before you can complete the activity.
  2. You can view the overall summary from C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\Summary.txt

Here, you have seen how to rebuild system databases in SQL Server 2008. You should rebuild system database only under conditions when you don’t have backups of system database or they are corrupted. When you rebuild system database it rebuilds MASTER, MSDB, and MODEL databases as a result you will lose all your Linked Server, Logins, SQL Server Job information.

<<Click here to see all posts>>

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove You Are Human Time limit is exhausted. Please reload CAPTCHA.