What are the solutions to master database corruption

Time:2020-10-18

After the SQL Server 2008 master database is damaged, the SQL Server service fails to start. Check the error log and you will see the following error message:

2015-10-27 10:15:21.01 spid6s      Starting up database ‘master’.
2015-10-27 10:15:23.01 spid6s error: 9003, severity: 20, status: 1.
2015-10-27 10:15:23.01 spid6s      The log scan number (227:418:1) passed to log scan in database ‘master’ is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.
2015-10-27 10:15:23.01 spid6s      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.

If the database version is the Chinese version, you will see an error message similar to the following:

The log scan number (227:418:1) passed to the log scan operation in database ‘master’ is invalid. This error may indicate data corruption or a mismatch between the log file (. LDF) and the data file (. MDF). If this error occurred during replication, recreate the publication. Otherwise, if the problem causes an error during startup, restore from a backup.

At this time, there are three methods to solve the damage of master database

1: Restore master database from backup

The premise of restoring the master database is that your master database is backed up. Remember that the master must also be backed up. Many times, some people will ignore these system databases when backing up. Generally, master and MSDB backup is required.

2: Copy master database template

If you do not have a master backup, go back to the next step and select templates in the installation directory to copy the master database file to the corresponding directory. If your SQL server is installed on Disk C and the installation path has not been modified, it may be C: program files / Microsoft SQL Server / mssql10. MSSqlServer / MSSQL / binn / templates

3: Rebuild master database

Find the installation media of SQL Server 2008 (insert the CD or copy the media to the corresponding directory), and change the directory to setup.exe File directory, and then run the following command (modify the relevant parameters according to the actual situation)


setup.exe
/QUIET
/ACTION=REBUILDDATABASE
/INSTANCENAME=instance_name
/SQLSYSADMINACCOUNTS= accounts
[/SAPWD=password]
[/SQLCOLLATION=collation_name]

Of course, there are many details. If the database has been patched and upgraded after installation, these patches may need to be re applied.

The above is about the solution of master database damage, I hope to help you.

Recommended Today

nuxt.js Imitating wechat app communication chat | Vue + nuxt chat | imitating wechat interface

Project overview be based on vue.js + nuxt.js +Chat room imitating wechat app interface developed by vuex + webpack + node + vant and other technologiesNuxtchatroom project。 It realizes the functions of card type drag and slide, message / expression sending, picture / video preview, red packet / circle of friends and so on. Technology […]