{"id":3821,"date":"2013-01-08T12:29:42","date_gmt":"2013-01-08T20:29:42","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=3821"},"modified":"2017-04-13T09:54:19","modified_gmt":"2017-04-13T16:54:19","slug":"corruption-demo-databases-and-scripts","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/","title":{"rendered":"Corruption demo databases and scripts"},"content":{"rendered":"<p>I originally blogged a series of corruption demos and associated databases back in 2008, for use with SQL Server 2005 and 2008. Since then the releases have changed which databases and corruptions work and I&#8217;ve had to rework some of the databases for you. This is an update that takes into account SQL Server 2008R2 and SQL Server 2012 and sets out everything clearly.<\/p>\n<p>I&#8217;m sure a bunch of you have never seen these &#8211; so something new for you to play with!<\/p>\n<p>The databases zips are:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.sqlskills.com\/resources\/conferences\/2005corruptdatabasesbackups.zip\">example corrupt databases<\/a>\u00a0(36-MB zip) containing:\n<ul>\n<li><strong>DemoDataPurity<\/strong>\n<ul>\n<li>192-MB SQL Server 2005 database with a single 2570 (data purity) error<\/li>\n<li>Works on 2005 and will upgrade and work on 2008, 2008R2, and 2012<\/li>\n<\/ul>\n<\/li>\n<li><strong>DemoFatalCorruption1<\/strong>\n<ul>\n<li>1-MB SQL Server 2005 database with a corrupt system table (that allows CHECKDB to complete)<\/li>\n<li>Only works on 2005<\/li>\n<\/ul>\n<\/li>\n<li><strong>DemoFatalCorruption2<\/strong>\n<ul>\n<li>1-MB SQL Server 2005 database with a corrupt system table (that terminates CHECKDB)<\/li>\n<li>Only works on 2005<\/li>\n<\/ul>\n<\/li>\n<li><strong>DemoNCIndex<\/strong>\n<ul>\n<li>192-MB SQL Server 2005 database with a bunch of nonclustered index corruptions<\/li>\n<li>Works on 2005 and will upgrade and work on 2008, 2008R2, and 2012<\/li>\n<\/ul>\n<\/li>\n<li><strong>DemoCorruptMetadata<\/strong>\n<ul>\n<li>1-MB SQL Server *2000* database with corrupt syscolumns table<\/li>\n<li>Upgrades and works on 2005, 2008, and 2008R2<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/resources\/conferences\/2008fatalcorruptionbackups.zip\">2008 fatal corruptions databases<\/a> (232KB zip) containing:\n<ul>\n<li><strong>DemoFatalCorruption1<\/strong>\n<ul>\n<li>1-MB SQL Server 2008 database with a corrupt system table (that allows CHECKDB to complete)<\/li>\n<\/ul>\n<\/li>\n<li><strong>DemoFatalCorruption2<\/strong>\n<ul>\n<li>1-MB SQL Server 2008 database with a corrupt system table (that terminates CHECKDB)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/resources\/conferences\/2008r2fatalcorruptionbackups.zip\">2008R2 fatal corruptions databases<\/a> (260KB zip) containing:\n<ul>\n<li><strong>DemoFatalCorruption1<\/strong>\n<ul>\n<li>1-MB SQL Server 2008R2 database with a corrupt system table (that allows CHECKDB to complete)<\/li>\n<\/ul>\n<\/li>\n<li><strong>DemoFatalCorruption2<\/strong>\n<ul>\n<li>1-MB SQL Server 2008R2 database with a corrupt system table (that terminates CHECKDB)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/resources\/conferences\/democorruptmetadata2008r2.zip\">2008R2 corrupt metadata database<\/a>\u00a0(260KB zip) containing:\n<ul>\n<li><strong>DemoCorruptMetadata<\/strong>\n<ul>\n<li>1-MB SQL Server 2008R2 database that was upgraded from a 2000 database with a corruption syscolumns database<\/li>\n<li>Works on 2008R2 and upgrades and works on 2012<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Note that I have not created DemoFatalCorruption databases yet for 2012.<\/p>\n<p>The <a href=\"https:\/\/www.sqlskills.com\/resources\/conferences\/corruptiondemoscripts.zip\">scripts zip<\/a> contains the following directories:<\/p>\n<ul>\n<li>\n<div>1 \u2013 Fatal Errors<\/div>\n<ul>\n<li>\n<div>This makes use of the DemoFatalCorruption1 and DemoFatalCorruption2 databases. The\u00a0<strong>FatalErrors.sql\u00a0<\/strong>script has the steps to follow and see\u00a0<a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/teched-demo-corruptions-fatal-to-dbcc-checkdb\/\">this blog post<\/a>\u00a0for a complete walk-through.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>2 \u2013 NC Indexes<\/div>\n<ul>\n<li>\n<div>This makes use of the DemoNCIndex database. The\u00a0<strong>NCIndexCorruption.sql<\/strong>\u00a0script has the steps to follow and see\u00a0<a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/teched-demo-nonclustered-index-corruption\/\">this blog post<\/a>\u00a0for a complete walk-through.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>3 \u2013 Data Purity<\/div>\n<ul>\n<li>\n<div>This makes use of the DemoDataPurity database. The\u00a0<strong>DataPurityCorruption.sql<\/strong>\u00a0script has the steps to follow. This has a database that generates a 2570 error and then walks you through fixing it.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>4 \u2013 Metadata<\/div>\n<ul>\n<li>\n<div>This makes use of the DemoCorruptMetadata database. The\u00a0<strong>CorruptMetadata.sql<\/strong>\u00a0script has the steps to follow and see\u00a0<a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-the-dedicated-admin-connection-to-fix-msg-8992-corrupt-system-tables\/\">this blog post<\/a>\u00a0for a complete walk-through. If you&#8217;re on 2012, you&#8217;ll need the 2008R2 corrupt metadata backup to restore from.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>5 \u2013 Restore or Repair<\/div>\n<ul>\n<li>\n<div>There&#8217;s a setup script (<strong>01CreateRestoreOrRepair.sql<\/strong>) and two demo scripts \u2013\u00a0<strong>FixUsingPageRestore.sql<\/strong>\u00a0and\u00a0<strong>FixUsingRepair.sql<\/strong>. There are script to use for 2005-2008R2 and for 2012. This creates a database with corruption and then shows fixing it using a page restore and then using repair and salvaging data from an older backup.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>6 \u2013 Suspect Database<\/div>\n<ul>\n<li>\n<div>This demo doesn&#8217;t come with a corrupt database \u2013 you create your own one. The\u00a0<strong>SuspectDatabase.sql<\/strong>\u00a0script has the steps to follow and see\u00a0<a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/creating-detaching-re-attaching-and-fixing-a-suspect-database\/\">this blog post<\/a>\u00a0for a complete walk-through.<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>I use a whole bunch more demos and scripts when I&#8217;m teaching about corruption, but these are the ones I&#8217;ve always made completely public.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I originally blogged a series of corruption demos and associated databases back in 2008, for use with SQL Server 2005 and 2008. Since then the releases have changed which databases and corruptions work and I&#8217;ve had to rework some of the databases for you. This is an update that takes into account SQL Server 2008R2 [&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,35,38],"tags":[],"class_list":["post-3821","post","type-post","status-publish","format-standard","hentry","category-checkdb-from-every-angle","category-corruption","category-disaster-recovery","category-example-scripts"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Corruption demo databases and scripts - 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\/corruption-demo-databases-and-scripts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Corruption demo databases and scripts - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"I originally blogged a series of corruption demos and associated databases back in 2008, for use with SQL Server 2005 and 2008. Since then the releases have changed which databases and corruptions work and I&#8217;ve had to rework some of the databases for you. This is an update that takes into account SQL Server 2008R2 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-08T20:29:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:54:19+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\/corruption-demo-databases-and-scripts\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/\",\"name\":\"Corruption demo databases and scripts - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2013-01-08T20:29:42+00:00\",\"dateModified\":\"2017-04-13T16:54:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Corruption demo databases and scripts\"}]},{\"@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":"Corruption demo databases and scripts - 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\/corruption-demo-databases-and-scripts\/","og_locale":"en_US","og_type":"article","og_title":"Corruption demo databases and scripts - Paul S. Randal","og_description":"I originally blogged a series of corruption demos and associated databases back in 2008, for use with SQL Server 2005 and 2008. Since then the releases have changed which databases and corruptions work and I&#8217;ve had to rework some of the databases for you. This is an update that takes into account SQL Server 2008R2 [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/","og_site_name":"Paul S. Randal","article_published_time":"2013-01-08T20:29:42+00:00","article_modified_time":"2017-04-13T16:54:19+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\/corruption-demo-databases-and-scripts\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/","name":"Corruption demo databases and scripts - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2013-01-08T20:29:42+00:00","dateModified":"2017-04-13T16:54:19+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/corruption-demo-databases-and-scripts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Corruption demo databases and scripts"}]},{"@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\/3821","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=3821"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/3821\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=3821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=3821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=3821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}