System Databases Recovery

So far, this chapter has dealt only with user databases, but the system databases are important to the recovery operation as well. The master database contains key database and security information, and the msdb database holds the schedules and jobs for SQL Server, as well as the backup history. A complete recovery plan must include the system databases.

Master Database

The master database, by default, uses the simple recovery model. Using only full backups for the master database is OK; it's not a transactional database.

Backing Up the Master Database

You back up the master database in the same manner as user databases.

Be sure to back up the master database when doing any of the following:

  • Creating or deleting databases
  • Modifying security by adding logins or changing roles
  • Modifying any server or database-configuration options

Because the msdb database holds a record of all backups, back up the master database and then the msdb database.

Recovering the Master Database

If the master database is corrupted or damaged, SQL Server won't start. Attempting to start SQL Server will have no effect. Attempting to connect to the instance with Management Studio invokes a warning that the server does not exist or that access is denied. The only solution is to first rebuild the master database using the command line setup as shown next, reapply any SQL Server updates, start SQL Server in single-user mode, and restore the master database.

1. Rebuild the master database ...

Get Microsoft SQL Server 2012 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.