{"id":3300,"date":"2011-05-04T05:00:00","date_gmt":"2011-05-04T05:00:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/emergency-database-restores\/"},"modified":"2016-07-28T10:50:24","modified_gmt":"2016-07-28T10:50:24","slug":"emergency-database-restores","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/emergency-database-restores\/","title":{"rendered":"Emergency Database Restores"},"content":{"rendered":"<p>I was reading a good article by Brent Ozar (<a href=\"http:\/\/www.brentozar.com\/\">blog<\/a>|<a href=\"http:\/\/www.twitter.com\/brento\">twitter<\/a>) on a <a href=\"http:\/\/www.brentozar.com\/archive\/2011\/05\/dba-nightmare-sql-server-down-restore-system-databases\/\">DBA Nightmare<\/a> where I came across this section:<\/p>\n<p>If you decide to restore the system databases, you should try this ahead of time.&#160; Restoring the master database is different than typical user databases because you can&#8217;t use SQL Server Management Studio.&#160; You have to <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms345416.aspx\">set the SQL Server to run in single-user mode<\/a>, then <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms190679.aspx\">use SQLCMD to restore the master database<\/a>, then remove the -m parameter that you added to start SQL Server, and start it back up again.&#160; If you&#8217;re using a third-party product to do your database backups, it&#8217;ll require separate instructions .<\/p>\n<p>Which immediately brought <a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-backup\/?utm_source=simpletalk&amp;utm_medium=weblink&amp;utm_content=grantbackuppro&amp;utm_campaign=sqlbackuppro\">Red Gate SQL Backup Pro<\/a> to my mind, since I&#8217;ve been working with it so much lately. This isn&#8217;t something I&#8217;ve tested while I&#8217;ve been learning about the product so I wasn&#8217;t sure if we had a good set of documentation on it. I shouldn&#8217;t have worried. <\/p>\n<p>I followed my nose, not even trying to do a serious search. I opened the help file, noticed a topic called &#8220;Backing up and Restoring.&#8221; I opened that and saw another one called &#8220;Restoring Backups.&#8221; 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:<\/p>\n<p><a id=\"o5972\"><\/a>    <\/p>\n<p>Restoring the master database<\/p>\n<p>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.<\/p>\n<ol>\n<li>Stop the SQL Server service. <\/li>\n<li>Open a command prompt window, and navigate to the SQL Server instance&#8217;s <em>Binn<\/em> folder. <\/li>\n<li>Start SQL Server in single user mode using <strong>sqlservr.exe c m<\/strong> for an unnamed instance, or <strong>sqlservr.exe c m s {instancename}<\/strong> for a named instance. <\/li>\n<li>Use the SQL Backup command line interface to restore the master database.\n<p>For example, at the command prompt, type:<\/p>\n<p>SQLBackupC -SQL &#8220;RESTORE DATABASE master FROM DISK = &#8216;C:Backupsmaster 20070101.sqb'&#8221;<\/p>\n<p>For a named instance, use the <strong>-I<\/strong> parameter to specify the instance name, for example:<\/p>\n<p>SQLBackupC -SQL &#8220;RESTORE DATABASE master FROM DISK = &#8216;G:Backupsmaster 20070101.sqb'&#8221; -I Instance2<\/p>\n<p>SQL Backup restores the master database, and SQL Server automatically stops the SQL Server service when the restore operation is complete.<\/p>\n<\/li>\n<li>You can now start the SQL Server in normal mode. <\/li>\n<\/ol>\n<p>     On the one hand, I&#8217;m really happy that we&#8217;ve got that right there in the documentation, where it&#8217;s really easy to find. On the other hand, I was already planning a new article in my head and now I can&#8217;t do that one. Talk about mixed feelings.  <\/p>\n<p>By the way, because of how it works, <a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-backup\/?utm_source=simpletalk&amp;utm_medium=weblink&amp;utm_content=grantbackuppro&amp;utm_campaign=hyperbac\">Hyperbac<\/a> wouldn&#8217;t be a concern in this same situation.<\/p>\n<p>For what it&#8217;s worth, go and read Brent. It falls right in line with what I&#8217;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&#8217;t tested your restore operations, and by that, I don&#8217;t just mean that you&#8217;ve tested the files, but that you&#8217;ve tested your knowledge and ability, then you don&#8217;t have a clue if you can actually restore your database. I&#8217;d rectify that situation immediately.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.&#160; Restoring the master database is different than typical user databases because you can&#8217;t use SQL Server Management Studio.&#160; You have&#8230;&hellip;<\/p>\n","protected":false},"author":221792,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-3300","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/221792"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=3300"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3300\/revisions"}],"predecessor-version":[{"id":42030,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3300\/revisions\/42030"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=3300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=3300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=3300"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=3300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}