{"id":1172,"date":"2007-10-02T23:26:00","date_gmt":"2007-10-02T23:26:00","guid":{"rendered":"\/blogs\/paul\/post\/CHECKDB-From-Every-Angle-EMERGENCY-mode-repair-the-very-very-last-resort.aspx"},"modified":"2026-03-30T19:02:57","modified_gmt":"2026-03-31T02:02:57","slug":"checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/","title":{"rendered":"EMERGENCY-mode repair: the very, very last resort"},"content":{"rendered":"<p>(Check out my online training courses: <a href=\"http:\/\/www.pluralsight.com\/courses\/sqlserver-database-corruption\" target=\"_blank\" rel=\"noopener noreferrer\">SQL Server: Detecting and Correcting Database Corruption<\/a>\u00a0and\u00a0<a href=\"http:\/\/www.pluralsight.com\/courses\/sqlserver-advanced-corruption-recovery-techniques\" target=\"_blank\" rel=\"noopener noreferrer\">SQL Server: Advanced Corruption Recovery Techniques<\/a>. We can also\u00a0<a href=\"https:\/\/www.sqlskills.com\/services\/sql-server-disaster-recovery\/\" target=\"_blank\" rel=\"noopener noreferrer\">help you<\/a>\u00a0with disaster recovery.)<\/p>\n<p>This is a follow-on from two posts:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-last-resorts-that-people-try-first\/\" target=\"_blank\" rel=\"noopener noreferrer\">Corruption: Last resorts that people try first&#8230;<\/a> where I discussed the two worst things you can do (in my opinion) to a database &#8211; rebuilding the transaction log and running <em>REPAIR_ALLOW_DATA_LOSS<\/em>.<\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-4-using-emergency-mode-to-access-a-recovery-pending-or-suspect-database\/\" target=\"_blank\" rel=\"noopener noreferrer\">Using EMERGENCY mode to access a RECOVERY PENDING or SUSPECT database<\/a> where I introduced <em>EMERGENCY<\/em> mode and walked through an example script showing its use.<\/li>\n<\/ul>\n<p>People get themselves into situations where they have no backups (or damaged backups) and the data or log files are damaged such that the only way to access the database is with <em>EMERGENCY<\/em> mode. In these situations, prior to SQL Server 2005, there was no documented or supported way to fix a database while in <em>EMERGENCY<\/em> mode &#8211; the only guidance could be found on the Internet or from calling Product Support and paying for help. The sequence of events was:<\/p>\n<ol>\n<li>Hack the system tables to get the database into <em>EMERGENCY<\/em> mode.<\/li>\n<li>Use the undocumented and unsupported <em>DBCC REBUILD_LOG<\/em> command to build a new transaction log.<\/li>\n<li>Run <em>DBCC CHECKDB<\/em> with the <em>REPAIR_ALLOW_DATA_LOSS<\/em> option to fix up corruptions in the data files &#8211; both those that may have caused the issue, and those caused by rebuilding the transaction log (e.g. because an active transaction altering the database structure was lost).<\/li>\n<li>Figure out what data was lost or is transactionally inconsistent (e.g. because a transaction altering multiple tables was lost) as far as your business logic is concerned<\/li>\n<li>Take the database out of <em>EMERGENCY<\/em> mode<\/li>\n<li>And then all the other stuff like root-cause analysis and getting a better backup strategy<\/li>\n<\/ol>\n<h2>How Does <em>EMERGENCY<\/em>-Mode Repair Work?<\/h2>\n<p>I decided to add a new feature to SQL Server 2005 called <em>EMERGENCY<\/em>-mode repair that will do steps 2 and 3 as an atomic operation. The reasons for this were:<\/p>\n<ul>\n<li>Much of the advice of how to do this on the Internet missed steps out (particularly missing step 3!)<\/li>\n<li>The <em>DBCC REBUILD_LOG<\/em> command was unsupported and undocumented and we didn&#8217;t like advising customers to use it<\/li>\n<li>Adding a documented, last-resort method of recovering from this situation would reduce calls to Product Support &#8211; saving time and money for customers and Microsoft.<\/li>\n<\/ul>\n<p>So, when in <em>EMERGENCY<\/em> mode, you can use <em>DBCC CHECKDB<\/em> to bring the database back online again. The only repair option allowed in <em>EMERGENCY<\/em> mode is <em>REPAIR_ALLOW_DATA_LOSS<\/em> and it does a lot more than usual:<\/p>\n<ul>\n<li>Forces recovery to run on the transaction log (if it exists). You can think of this as &#8216;recovery with <em>CONTINUE_AFTER_ERROR<\/em>&#8216; &#8211; see <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/example-20002005-corrupt-databases-and-some-more-info-on-backup-restore-page-checksums-and-io-errors\/\" target=\"_blank\" rel=\"noopener noreferrer\">this post<\/a> for more details on the real <em>CONTINUE_AFTER_ERROR<\/em> options for <em>BACKUP<\/em> and <em>RESTORE<\/em>. The idea behind this is that the database is already inconsistent because either the transaction log is corrupt or something in the database is corrupt in such a way that recovery cannot complete. So, given that the database is inconsistent and we&#8217;re about to rebuild the transaction log, it makes sense to salvage as much transactional information as possible from the log before we throw it away and build a new one.<\/li>\n<li>Rebuild the transaction log &#8211; but only if the transaction log is corrupt.<\/li>\n<li>Run <em>DBCC CHECKDB<\/em> with the <em>REPAIR_ALLOW_DATA_LOSS<\/em> option.<\/li>\n<li>Set the database state to <em>ONLINE<\/em>.<\/li>\n<\/ul>\n<p>It&#8217;s a one-way operation and can&#8217;t be rolled back. I always advise taking a copy of the database files before doing this in case something goes wrong or there are unrepairable errors. And if it does? Probably time to update your resume for not having a water-tight backup and disaster-recovery strategies in place. I have seen it fail several times in real customer situations. It&#8217;s not pretty when it does.<\/p>\n<h2><em>EMERGENCY<\/em>-Mode Repair Example<\/h2>\n<p>Let&#8217;s walk-through an example of using it. I&#8217;m assuming there&#8217;s a database called <em>EmergencyDemo<\/em> that&#8217;s in the same state as at the end of the second post I link to at the beginning of this post: the database has no log file, is in <em>EMERGENCY<\/em> mode and the <em>salaries<\/em> table is corrupt.<\/p>\n<p>First off I&#8217;ll try bringing the database online, just to see what happens:<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nALTER DATABASE &#x5B;EmergencyDemo] SET ONLINE;\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nFile activation failure. The physical file name &quot;C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\EmergencyDemo_log.LDF&quot; may be incorrect.\r\nThe log cannot be rebuilt because the database was not cleanly shut down.\r\nMsg 945, Level 14, State 2, Line 1\r\nDatabase &#039;EmergencyDemo&#039; cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.\r\nFailed to restart the current database. The current database is switched to master.\r\nMsg 5069, Level 16, State 1, Line 1\r\nALTER DATABASE statement failed.\r\n<\/pre>\n<p>The first message makes sense &#8211; the database knows it needs to be recovered because it wasn&#8217;t cleanly shut down, but the log file simply isn&#8217;t there. The second message is from the new feature in 2005 that will automatically create a log file if one is missing on startup or attach &#8211; as long as the database was cleanly shut down. The 945 and 5069 errors are self-explanatory but notice that the database gets switched to <em>master<\/em> underneath us. This has bitten me several times in the past.<\/p>\n<p>Well, I expected that not to work. Let&#8217;s run <em>EMERGENCY<\/em>-mode repair:<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nDBCC CHECKDB (N&#039;EmergencyDemo&#039;, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS, NO_INFOMSGS;\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nMsg 945, Level 14, State 2, Line 1\r\nDatabase &#039;EmergencyDemo&#039; cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.\r\n<\/pre>\n<p>Hmm &#8211; looks like the failed <em>ALTER DATABASE<\/em> statement did change the state &#8211; but what to?<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nSELECT\r\n    &#x5B;state_desc]\r\nFROM\r\n    sys.databases\r\nWHERE\r\n    &#x5B;name] = N&#039;EmergencyDemo&#039;;\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nstate_desc\r\n-----------------\r\nRECOVERY_PENDING\r\n<\/pre>\n<p>That makes sense because the log file does not exist. The recovery system knows that recovery has to run on the database but it is unable to start without the log file.<\/p>\n<p>Back to <em>EMERGENCY<\/em> mode and runing repair:<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nALTER DATABASE &#x5B;EmergencyDemo] SET EMERGENCY;\r\nGO\r\nDBCC CHECKDB (N&#039;EmergencyDemo&#039;, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS, NO_INFOMSGS;\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nMsg 7919, Level 16, State 3, Line 1\r\nRepair statement not processed. Database needs to be in single user mode.\r\n<\/pre>\n<p><em>EMERGENCY<\/em> mode is not <em>SINGLE_USER<\/em> mode. A database needs to be in <em>SINGLE_USER<\/em> mode for repair to run and <em>EMERGENCY<\/em> mode allows multiple connections from members of the sysadmin role. You can set <em>SINGLE_USER<\/em> mode as well as <em>EMERGENCY <\/em>mode &#8211; however, the <em>sys.databases<\/em> field <em>state_desc<\/em> will still just say <em>EMERGENCY<\/em>.<\/p>\n<p>Btw, if the <em>ALTER DATABASE<\/em> statement to set the database into <em>EMERGENCY<\/em> mode fails, try setting the database <em>OFFLINE<\/em> and then <em>ONLINE<\/em> again first. Then set <em>EMERGENCY<\/em> mode and continue with the code below.<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nALTER DATABASE &#x5B;EmergencyDemo] SET SINGLE_USER;\r\nGO\r\nDBCC CHECKDB (N&#039;EmergencyDemo&#039;, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS, NO_INFOMSGS;\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nFile activation failure. The physical file name &quot;C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\EmergencyDemo_log.LDF&quot; may be incorrect.\r\nThe log cannot be rebuilt because the database was not cleanly shut down.\r\nWarning: The log for database &#039;EmergencyDemo&#039; has been rebuilt. Transactional consistency has been lost. The RESTORE chain was broken, and the server no longer has context on the previous log files, so you will need to know what they were. You should run DBCC CHECKDB to validate physical consistency. The database has been put in dbo-only mode. When you are ready to make the database available for use, you will need to reset database options and delete any extra log files.\r\n<\/pre>\n<p>This time it worked. First of all we get the same error as if we tried to bring the database online &#8211; that&#8217;s from the code that&#8217;s trying to run &#8216;recovery with <em>CONTINUE_AFTER_ERROR<\/em>&#8216; on the transaction log. Next we get a nice long warning that the transaction log has been rebuilt and the consequences of doing that (basically that you need to start a new log backup chain by taking a full or differential backup). If there had been any corruptions we&#8217;d have seen the usual output from <em>DBCC CHECKDB<\/em> about what errors it found and fixed. There&#8217;s also a bunch of stuff in the error log:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\n2013-01-20 15:45:45.550 spid51       Starting up database &#039;EmergencyDemo&#039;.\r\n2013-01-20 15:45:45.560 spid51       Error: 5105, Severity: 16, State: 1.\r\n2013-01-20 15:45:45.560 spid51       A file activation error occurred. The physical file name &#039;C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\EmergencyDemo_log.LDF&#039; may be incorrect. Diagnose and correct additional errors, and retry the operation.\r\n2013-01-20 15:45:45.560 spid51       Starting up database &#039;EmergencyDemo&#039;.\r\n2013-01-20 15:45:45.610 spid51       Starting up database &#039;EmergencyDemo&#039;.\r\n2013-01-20 15:45:45.630 spid51       Warning: The log for database &#039;EmergencyDemo&#039; has been rebuilt. Transactional consistency has been lost. The RESTORE chain was broken, and the server no longer has context on the previous log files, so you will need to know what they were. You should run DBCC CHECKDB to validate physical consistency. The database has been put in dbo-only mode. When you are ready to make the database available for use, you will need to reset database options and delete any extra log files.\r\n2013-01-20 15:45:45.730 spid51       EMERGENCY MODE DBCC CHECKDB (EmergencyDemo, repair_allow_data_loss) WITH all_errormsgs, no_infomsgs executed by APPLECROSS\\paul found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.\r\n<\/pre>\n<p>Note that the usual error log entry from running <em>DBCC CHECKDB<\/em> is preceded by &#8216;<em>EMERGENCY MODE<\/em>&#8216; this time.<\/p>\n<p>Checking the database state:<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nSELECT\r\n    &#x5B;state_desc]\r\nFROM\r\n    sys.databases\r\nWHERE\r\n    &#x5B;name] = N&#039;EmergencyDemo&#039;;\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nstate_desc\r\n-----------\r\nONLINE\r\n<\/pre>\n<p>We find that it&#8217;s been brought back online again because everything worked. Let&#8217;s see what happened to our table:<\/p>\n<pre class=\"brush: sql; gutter: true; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nUSE &#x5B;EmergencyDemo];\r\nGO\r\nSELECT * FROM &#x5B;salaries];\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nFirstName  LastName    Salary\r\n---------- ----------- -------\r\nJohn       Williamson  10000\r\nStephen    Brown       0\r\nJack       Bauer       10000\r\n\r\n(3 row(s) affected)\r\n<\/pre>\n<p>And of course its still corrupt &#8211; because even though the transaction log was rebuilt and repaired, the original transaction that changed the salary to 0 never got a chance to rollback because I deleted the transaction log (in the previous post).<\/p>\n<p>Now remember, you should only use this as a last resort, but if you do get yourself into trouble, you know there&#8217;s a command that should be able to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Check out my online training courses: SQL Server: Detecting and Correcting Database Corruption\u00a0and\u00a0SQL Server: Advanced Corruption Recovery Techniques. We can also\u00a0help you\u00a0with disaster recovery.) This is a follow-on from two posts: Corruption: Last resorts that people try first&#8230; where I discussed the two worst things you can do (in my opinion) to a database &#8211; [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,30,34,35,38,74,98],"tags":[],"class_list":["post-1172","post","type-post","status-publish","format-standard","hentry","category-checkdb-from-every-angle","category-corruption","category-dbcc","category-disaster-recovery","category-example-scripts","category-repair","category-transaction-log"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Server EMERGENCY mode repair<\/title>\n<meta name=\"description\" content=\"How EMERGENCY-mode repair works and how to use it, from the person who wrote DBCC CHECKDB.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server EMERGENCY mode repair\" \/>\n<meta property=\"og:description\" content=\"How EMERGENCY-mode repair works and how to use it, from the person who wrote DBCC CHECKDB.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2007-10-02T23:26:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-31T02:02:57+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/\",\"name\":\"SQL Server EMERGENCY mode repair\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2007-10-02T23:26:00+00:00\",\"dateModified\":\"2026-03-31T02:02:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"description\":\"How EMERGENCY-mode repair works and how to use it, from the person who wrote DBCC CHECKDB.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"EMERGENCY-mode repair: the very, very last resort\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server EMERGENCY mode repair","description":"How EMERGENCY-mode repair works and how to use it, from the person who wrote DBCC CHECKDB.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server EMERGENCY mode repair","og_description":"How EMERGENCY-mode repair works and how to use it, from the person who wrote DBCC CHECKDB.","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/","og_site_name":"Paul S. Randal","article_published_time":"2007-10-02T23:26:00+00:00","article_modified_time":"2026-03-31T02:02:57+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/","name":"SQL Server EMERGENCY mode repair","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2007-10-02T23:26:00+00:00","dateModified":"2026-03-31T02:02:57+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"description":"How EMERGENCY-mode repair works and how to use it, from the person who wrote DBCC CHECKDB.","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"EMERGENCY-mode repair: the very, very last resort"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=1172"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1172\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=1172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=1172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=1172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}