{"id":4832,"date":"2017-11-21T15:59:39","date_gmt":"2017-11-21T23:59:39","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=4832"},"modified":"2017-11-21T15:59:39","modified_gmt":"2017-11-21T23:59:39","slug":"disaster-recovery-101-fixing-a-broken-system-table-page","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/","title":{"rendered":"Disaster recovery 101: fixing a broken system table page"},"content":{"rendered":"<p style=\"text-align: justify;\">This post is\u00a0about a disaster-recovery scenario I\u00a0described in our bi-weekly\u00a0<a href=\"https:\/\/www.sqlskills.com\/newsletter\/\" target=\"_blank\" rel=\"noopener noreferrer\">newsletter<\/a> a couple of weeks ago, and wanted to make sure it&#8217;s\u00a0out on the web too for people to find and use.<\/p>\n<p style=\"text-align: justify;\">I was helping someone try to recover data from a corrupt database, from an online forum question. They did not have any up-to-date backups without the corruption in, so fixing their backup strategy was a piece of advice they were given by a few people.<\/p>\n<p style=\"text-align: justify;\">The output from DBCC CHECKDB on the database was:<\/p>\n<p style=\"text-align: justify; padding-left: 30px;\"><em>Msg 8921, Level 16, State 1, Line 1<\/em><br \/>\n<em> Check terminated. A failure was detected while collecting facts. Possibly tempdb out of space or a system table is inconsistent. Check previous errors.<\/em><br \/>\n<em> Msg 824, Level 24, State 2, Line 1<\/em><br \/>\n<em> SQL Server detected a logical consistency-based I\/O error: torn page (expected signature: 0x0; actual signature: 0x5555300). It occurred during a read of page (1:58) in database ID 10 at offset 0x00000000074000 in file &#8216;D:\\dbname.mdf:MSSQL_DBCC10&#8217;. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.<\/em><\/p>\n<p style=\"text-align: justify;\">They\u2019d tried running repair, but of course if <em>DBCC CHECKDB<\/em> says that it has to stop (i.e. error message 8921), then it can\u2019t run repair.<\/p>\n<p style=\"text-align: justify;\">I explained this, and how page 1:58 is a system table page and unrepairable, and so they\u2019d have to script out as much of the database schema as possible, create a new database, and extract as much data as possible from the broken database.<\/p>\n<p style=\"text-align: justify;\">I also explained that the page is part of the <em>sys.syscolpars<\/em> table, which is the equivalent of the old <em>syscolumns<\/em>\u00a0system table, so that approach might not work if the corruption was such that it stopped the Query Processor from being able to use the table metadata.<\/p>\n<p style=\"text-align: justify;\">Unfortunately my suspicions were correct, and the script\/extract approach did indeed fail.<\/p>\n<p style=\"text-align: justify;\">On a whim, I suggested trying something radical. A few years ago I blogged about a way to \u2018fix\u2019 broken boot pages using a hex editor to overwrite a broken boot page with one from an older copy of the database (see <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-boot-page\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>) and demonstrated it at various conferences. I\u2019d never tried it on a system table page before, but I figured that the page ID was low enough that the page likely hadn\u2019t changed for a while.<\/p>\n<p style=\"text-align: justify;\">What do I mean by that? Well, the <em>sys.syscolpars<\/em> clustered index is ordered by object ID, so the first few pages in the clustered index (of which page 1:58 is one), have the columns from the system tables, with very low object IDs. There\u2019s never going to be the case where a new user table gets created and causes an insert into one of these low tables.<\/p>\n<p style=\"text-align: justify;\">This means that an older backup of the database would have the current state of page 1:58 in it. So I suggested using the boot page hack on page 1:58 from the person\u2019s older backup.<\/p>\n<p style=\"text-align: justify;\">And it worked!<\/p>\n<p style=\"text-align: justify;\">Luckily there wasn\u2019t any other corruption in the database, so all the person had to do was root-cause analysis and remediation, and fixing the backup strategy so the situation wouldn\u2019t arise in future.<\/p>\n<p style=\"text-align: justify;\"><strong>Summary<\/strong>: In a disaster situation, when backups aren\u2019t available; don\u2019t be afraid to try something radical. As long as you try it on a copy of the database, it\u2019s not as if you can make the situation any worse. And if you\u2019re lucky, you\u2019ll be able to make the situation a lot better.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is\u00a0about a disaster-recovery scenario I\u00a0described in our bi-weekly\u00a0newsletter a couple of weeks ago, and wanted to make sure it&#8217;s\u00a0out on the web too for people to find and use. I was helping someone try to recover data from a corrupt database, from an online forum question. They did not have any up-to-date backups [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,35],"tags":[],"class_list":["post-4832","post","type-post","status-publish","format-standard","hentry","category-corruption","category-disaster-recovery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Disaster recovery 101: fixing a broken system table page - Paul S. Randal<\/title>\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\/disaster-recovery-101-fixing-a-broken-system-table-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Disaster recovery 101: fixing a broken system table page - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"This post is\u00a0about a disaster-recovery scenario I\u00a0described in our bi-weekly\u00a0newsletter a couple of weeks ago, and wanted to make sure it&#8217;s\u00a0out on the web too for people to find and use. I was helping someone try to recover data from a corrupt database, from an online forum question. They did not have any up-to-date backups [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-21T23:59:39+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=\"3 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\/disaster-recovery-101-fixing-a-broken-system-table-page\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/\",\"name\":\"Disaster recovery 101: fixing a broken system table page - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2017-11-21T23:59:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Disaster recovery 101: fixing a broken system table page\"}]},{\"@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":"Disaster recovery 101: fixing a broken system table page - Paul S. Randal","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\/disaster-recovery-101-fixing-a-broken-system-table-page\/","og_locale":"en_US","og_type":"article","og_title":"Disaster recovery 101: fixing a broken system table page - Paul S. Randal","og_description":"This post is\u00a0about a disaster-recovery scenario I\u00a0described in our bi-weekly\u00a0newsletter a couple of weeks ago, and wanted to make sure it&#8217;s\u00a0out on the web too for people to find and use. I was helping someone try to recover data from a corrupt database, from an online forum question. They did not have any up-to-date backups [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/","og_site_name":"Paul S. Randal","article_published_time":"2017-11-21T23:59:39+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/","name":"Disaster recovery 101: fixing a broken system table page - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2017-11-21T23:59:39+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/disaster-recovery-101-fixing-a-broken-system-table-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Disaster recovery 101: fixing a broken system table page"}]},{"@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\/4832","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=4832"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4832\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=4832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=4832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=4832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}