Emergency Database Restores

I was reading a good article by Brent Ozar (blog|twitter) on a DBA Nightmare where I came across this section:

If you decide to restore the system databases, you should try this ahead of time.  Restoring the master database is different than typical user databases because you can’t use SQL Server Management Studio.  You have to set the SQL Server to run in single-user mode, then use SQLCMD to restore the master database, then remove the -m parameter that you added to start SQL Server, and start it back up again.  If you’re using a third-party product to do your database backups, it’ll require separate instructions .

Which immediately brought Red Gate SQL Backup Pro to my mind, since I’ve been working with it so much lately. This isn’t something I’ve tested while I’ve been learning about the product so I wasn’t sure if we had a good set of documentation on it. I shouldn’t have worried.

I followed my nose, not even trying to do a serious search. I opened the help file, noticed a topic called “Backing up and Restoring.” I opened that and saw another one called “Restoring Backups.” I opened that up and scrolled through, the first place I looked mind you, fully expecting to have to start to search, when right there near the end of the documentation on the basic restore operation I found this section:

Restoring the master database

To restore the master database, you must use the SQL Backup command line to ensure that the SQL Server is started in single user mode.

  1. Stop the SQL Server service.
  2. Open a command prompt window, and navigate to the SQL Server instance’s Binn folder.
  3. Start SQL Server in single user mode using sqlservr.exe c m for an unnamed instance, or sqlservr.exe c m s {instancename} for a named instance.
  4. Use the SQL Backup command line interface to restore the master database.

    For example, at the command prompt, type:

    SQLBackupC -SQL “RESTORE DATABASE master FROM DISK = ‘C:Backupsmaster 20070101.sqb'”

    For a named instance, use the -I parameter to specify the instance name, for example:

    SQLBackupC -SQL “RESTORE DATABASE master FROM DISK = ‘G:Backupsmaster 20070101.sqb'” -I Instance2

    SQL Backup restores the master database, and SQL Server automatically stops the SQL Server service when the restore operation is complete.

  5. You can now start the SQL Server in normal mode.

On the one hand, I’m really happy that we’ve got that right there in the documentation, where it’s really easy to find. On the other hand, I was already planning a new article in my head and now I can’t do that one. Talk about mixed feelings.

By the way, because of how it works, Hyperbac wouldn’t be a concern in this same situation.

For what it’s worth, go and read Brent. It falls right in line with what I’ve been saying. Your backups are only good if you can restore them. You only know that you can restore them after the restore is completed. If you haven’t tested your restore operations, and by that, I don’t just mean that you’ve tested the files, but that you’ve tested your knowledge and ability, then you don’t have a clue if you can actually restore your database. I’d rectify that situation immediately.