{"id":251,"date":"2009-06-03T18:38:40","date_gmt":"2009-06-03T16:38:40","guid":{"rendered":"https:\/\/www.sqlinthewild.co.za\/?p=251"},"modified":"2009-06-03T18:38:40","modified_gmt":"2009-06-03T16:38:40","slug":"does-repair_allow_data_loss-cause-data-loss","status":"publish","type":"post","link":"https:\/\/www.sqlinthewild.co.za\/index.php\/2009\/06\/03\/does-repair_allow_data_loss-cause-data-loss\/","title":{"rendered":"Does Repair_Allow_Data_Loss cause data loss?"},"content":{"rendered":"<p>Short answer: Yes. That&#8217;s why the option has that name.<\/p>\n<p>Long answer:<\/p>\n<p>When CheckDB finds corruption it will, as part of the output, include the minimum level of repair that will fix the errors that it found. In SQL 2005 and higher, it will look something like the following.<\/p>\n<blockquote><p>CHECKDB found 42 allocation errors and 137 consistency errors in database &#8216;SomeDB&#8217;.<br \/>\nrepair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (SomeDB).<\/p><\/blockquote>\n<p>There are two options for the minimum repair level. REPAIR_REBUILD and REPAIR_ALLOW_DATA_LOSS.<\/p>\n<p>If the minimum level is REPAIR_REBUILD then it means that the corruption was confined to just the nonclustered indexes. This is good. Nonclustered indexes are redundant data and hence can be dropped and recreated (which is pretty much what CheckDB with the REPAIR_REBUILD option does)<\/p>\n<p>If the minumum level is REPAIR_ALLOW_DATA_LOSS then running CheckDB with the REPAIR_ALLOW_DATA_LOSS option will cause data loss. That&#8217;s why the option is named like that. How much it will lose depends on the extent of the corruption.<\/p>\n<p>There&#8217;s one other case. What about when checkDB doesn&#8217;t specify a minimum level?<\/p>\n<blockquote><p>CHECKDB found 3 allocation errors and 7 consistency errors in database &#8216;SomeDB&#8217;.<\/p><\/blockquote>\n<p>That means that there&#8217;s damage to one or more of the allocation pages or there&#8217;s corruption in the system tables. That kind of corruption isn&#8217;t repairable, so no minimum repair level can be specified.<\/p>\n<p>So, in conclusion, will running CheckDB with the REPAIR_ALLOW_DATA_LOSS option cause data loss? If that&#8217;s the minimum level that CheckDB specified, then yes it will.<\/p>\n<p>For more info, see <a href=\"http:\/\/www.sqlskills.com\/BLOGS\/PAUL\/post\/Misconceptions-around-database-repair.aspx\">Paul Randal&#8217;s blog<\/a> and an <a href=\"http:\/\/www.sqlservercentral.com\/articles\/65804\/\">article that I wrote<\/a> at <a href=\"http:\/\/www.sqlservercentral.com\/\">SQL Server Central<\/a>.<\/p>\n<p>Edit: There is one case where the repair level repair_allow_data_loss is required, but no data will be lost. This is the case of the incorrect PFS page (see my article at SQLServerCentral for more info). If that is the only error, repair_allow_data_loss will be the minimum level, but no data will actually be lost.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short answer: Yes. That&#8217;s why the option has that name. Long answer: When CheckDB finds corruption it will, as part of the output, include the minimum level of repair that will fix the errors that it found. In SQL 2005&#8230; <a class=\"read-more-button\" href=\"https:\/\/www.sqlinthewild.co.za\/index.php\/2009\/06\/03\/does-repair_allow_data_loss-cause-data-loss\/\">(Read more)<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22,15,16],"tags":[],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-corruption","category-sql-server","category-syndication"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7h6n-43","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/comments?post=251"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}