When the master database gets deleted, corrupted or damaged in some way, then Microsoft SQL server would greatly break down. To rebuild the master database in MS SQL server 2005/2008 r2/2017 .etc, database administrators can use the tools already at hand, including the built-in Rebuild Wizard and third-party EaseUS MS SQL repair tool.
A master database plays an indispensable role in SQL server, because it's recognized as the primary configuration database, and it usually exists in forms of two files - an MDF file and an LDF file. As we know, the MDF file (master.mdf) is the primary database file that contains schema and data, whereas the LDF file (mastlog.ldf) stores the parallel transaction logs. When the master database gets deleted, corrupted or damaged in some way and cannot restore from the backup, then Microsoft SQL server would greatly break down. Being a Microsoft SQL server administrator, it's essential to know how to fix a corrupted master database with the tools already at hand, including the built-in Rebuild Wizard and third-party EaseUS MS SQL repair tool.
Both tools are supposed to help administrators deal with commonplace MS SQL server problems that need a rebuild, restore or recovery. There are three scenarios, in general, in which you may need to apply either tool to get a server back to its initial health state.
NOTE: It can be tricky to restore master database because it contains the information about all the databases in the instance and it is required to startup. So, we recommend you take a full backup of the master database before proceeding with the next troubleshooting solutions, in case of any mishap. See three SQL server recovery models.
The Rebuild Wizard utility (rebuildm.exe) is located in a default user directory: Program Files\Microsoft SQL Server\ 80\Tools\Binn subdirectory. Navigate to the path and double click on the program to start the Rebuild Wizard.
Step 1: Upon verifying the information, click Rebuild to let the utility to build a brand new master database for your SQL server.
Step 2: After you're returned to a good master database, log in a single-user mode this time. To start the server in a single-user mode, run this command on the command prompt.
sqlservr.exe –c -m
Step 3: Next, open SQL Server Configuration Manager and switch to the Startup Parameter section. Specify -m in the parameter box and click Add. Then click Apply.
Step 4: Type the following syntax to rebuild the master database in SQL Server 2005.
Start /wait setup.exe /qn INSTANCENAME= REINSTALL=SQL_Engine REBUILDDATABASE=1 sapwd=< NewStrongPassword>
After the four steps of operation, you should be able to rebuild the corrupt the master database together with model and msdb on the same disk.
EaseUS MS SQL Recovery is a third-party SQL repair utility, so you need to download and install it for use. With great compatibilities in all operating systems and server editions, EaseUS MS SQL Recovery is mainly designed for restoring corrupt MDF/NDF files, fixing database log files and recovering corrupted objects like tables, indexes, triggers, keys, views, stored procedures, functions, and more.
Apart from the capability of restoring a corrupt or failed SQL Server resulted from master database problems, it has added powerful features of locating and restoring deleted data and records. What's more, it's flexible for you to save a repaired database, with options of 4 formats: MSSQL, CSV, XLS, and HTML.
Step 1: Select the corrupted database for recovery
Note: To use this software, you need to stop the SQL Server service.
Step 2: Repair the corrupted database
Step 3: Export to the database or as scripts
Note: Before clicking "OK", you need to restart the SQL Server service.
In the event that your master database is corrupted, or destroyed badly and cannot restore from backups, the rebuild.exe and EaseUS SQL software can be of great help to rebuild it to its default state.
Choosing Rebuild Wizard, it's going to be time-consuming, tedious and somewhat sophisticated to rebuild a master database, which usually requires reinstalling the SQL server from scratch. On the contrary, EaseUS MS SQL repair tool is comparatively easy to initiate the troubleshooting in an automated way. It provides a GUI interface that allows users to specify the source files, and it asks for only a click of Repair for a complete recovery.
Related Articles
3 Ways to Open MS SQL Sever Backup .BAK File in Excel
SQL to XML | How to Export Data from SQL Server to XML
MS SQL Repair Tool | Repair Corrupted MDF/NDF File
How to Fix Database from MDF File in SQL Server 2008/2008 R2