Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Backup and restore system database of SQL Server

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

System database is a necessary database for managing and maintaining SQL Server, and it is very important for the operation of server instances. Multiple system databases, including master, model and msdb, must be backed up after a large number of updates. By backing up these system databases, the SQL Server system can be restored and restored in the event of a system failure (such as hard disk loss).

System databases to be backed up

1. Back up the system database

two。 Simulate database corruption

(1) first, stop the SQL Server service

(2) then delete the system database file

(3) start the SQL Server service again and find that the system reports an error and the SQL Server database system is paralyzed

3. Now start rebuilding the database.

(1) first, insert the system CD

(2) enter the character interface, locate and execute the installation command

If it is Windows authentication mode, the required syntax is as follows:

Setup / ACTION=REBUILDDATABASE / QUIET / INSTANCENAME= / SQLSYSADMINACCOUNTS=?

If you are in mixed authentication mode, you also need to use the / SAPWD parameter to provide the password for sa. The syntax is as follows:

Setup / ACTION=REBUILDDATABASE / QUIET / INSTANCENAME= / SQLSYSADMINACCOUNTS= / SAPWD=

My database is in mixed authentication mode, so enter the following command:

4. Now restart the service, open the database, and find that the database is initialized, so you need to restore the master database

(1) enable SQL Server service in single-user mode

Netstart MSSQLSERVER / m / s

(2) Credit connection to SQLServer server instance

Sqlcmd-e-s ServerName

(3) restore the master database after connecting

Restore database master from disk='master backup file path'

Go

5. Now start the service, open the database, and find that the database is back to normal

6. Restore msdb database

7. Restore model database

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report