Restore an SQL Server System Database

Source: Internet
Author: User
Tags mssqlserver
The recovery of the system database is summarized as follows:

In the SQL Server database, the system information is stored in the system database. The main system databases include master, which controls the user database and SQL server operations as a whole, after creating any User-Defined Object, back up it:

Model-provides templates and prototypes for new databases

MSDB-contains information about jobs, alarms, and operators

If the media that contains the system database changes, you must re-build the system database. If you can still start the SQL Server service, you can use the restore statement to restore the database from the backup of the system database. If the master node fails and the system cannot be started, follow these steps:

1. Rebuild the system database and run C: mssql7binnrebuildm.exe. Follow the prompts to find the path of the system database sample during the process, which can be found on the installation disc;

2. after the system database is rebuilt, start the SQL Server service and use the backup of the system database to restore the database. Generally, the recovery sequence is master> MSDB> model. When restoring the backup of the master, pay attention to the following: it must be in single user mode. There are several ways to enter Single User Mode:

1. you can enter sqlservr-C-F-m in command line mode or sqlservr-M, where-C can shorten the startup time, SQL Server is not started as a Windows NT Service-F start SQL Server in single-user mode with minimum configuration

2. You can enter-C-F-M or-m in the startup parameters of control panel-service-MSSQLServer, and click Start.

3. There is also a more flexible startup method: Start with a startup parameter that exists in the Registry

Add the singleuser entry under MSSQLServer, as shown in the following figure:

HKEY_LOCAL_MACHINE
Software
Microsoft
MSSQLServer
Singleuser
Parameters
Sqlarg0: REG_SZ:-DC: mssql7datamaster. dat
Sqlarg1: REG_SZ:-EC: mssql7logerrorlog
Sqlarg2: REG_SZ:-LC: mssql7datamastlog. dat
Sqlarg3: REG_SZ:-m

Enter sqlservr-C-ssingleuser in the command line. Note: You must start query analyzer to execute the statement after entering single-user mode in the command line:

Restore database master form disk = 'C :( specific backup file name )'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.