{"id":9977,"date":"2017-04-23T20:39:33","date_gmt":"2017-04-23T18:39:33","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/"},"modified":"2017-04-23T20:39:33","modified_gmt":"2017-04-23T18:39:33","slug":"12cr2-rman-repair","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/","title":{"rendered":"12cR2 RMAN&gt; REPAIR"},"content":{"rendered":"<h2>By Franck Pachot<\/h2>\n<p>.<br \/>\nDo you know the RMAN Recovery advisor? It detects the problems, and then you:<\/p>\n<pre><code>\nRMAN&gt; list failure;\nRMAN&gt; advise failure;\nRMAN&gt; repair failure;\n<\/code><\/pre>\n<p>You need to have a failure detected. You can run Health Check if it was not detected automatically (see <a href=\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-rman-list-failure-does-not-show-any-failure-even-if-there-is-one\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.dbi-services.com\/blog\/oracle-12c-rman-list-failure-does-not-show-any-failure-even-if-there-is-one\/<\/a>). In 12.2 you can run the repair directly, by specifying what you want to repair.<br \/>\n<!--more--><\/p>\n<h3>Syntax<\/h3>\n<p>There is no online help on RMAN but you can list which keywords are expected by supplying a wrong one:<\/p>\n<pre><code>RMAN&gt; repair xxx;\n&nbsp;\nRMAN-00571: ===========================================================\nRMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============\nRMAN-00571: ===========================================================\nRMAN-00558: error encountered while parsing input commands\nRMAN-01009: syntax error: found \"identifier\": expecting one of: \"failure\"\nRMAN-01008: the bad identifier was: xxx\nRMAN-01007: at line 1 column 8 file: standard input<\/code><\/pre>\n<p>This is 12.1.0.2 where the only option is REPAIR FAILURE. In 12.2 we have a lot more:<\/p>\n<pre><code>\nRMAN&gt; repair xxx\n&nbsp;\nRMAN-00571: ===========================================================\nRMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============\nRMAN-00571: ===========================================================\nRMAN-00558: error encountered while parsing input commands\nRMAN-01009: syntax error: found \"identifier\": expecting one of: \"database, database root, datafile, failure, pluggable, tablespace, (\"\nRMAN-01008: the bad identifier was: xxx\nRMAN-01007: at line 1 column 8 file: standard input\n<\/code><\/pre>\n<p>When you know what is broken, you can repair it without having to know what to restore and what to recover. You can repair:<\/p>\n<ul>\n<li>database: the whole database<\/li>\n<li>database root: the CDB$ROOT container, which means all its tablespaces<\/li>\n<li>pluggable database: it means all the PDB tablespaces<\/li>\n<li>a specific datafile<\/li>\n<\/ul>\n<h3>Repair pluggable database<\/h3>\n<p>I corrupt one datafile from PDB01:<\/p>\n<pre><code>\nRMAN&gt; host \"&gt; \/u01\/oradata\/CDB2\/CDB2_SITE1\/46EA7EF707457B4FE0531416A8C027F2\/datafile\/o1_mf_system_d8k2t4wj_.dbf\";\nhost command complete\n<\/code><\/pre>\n<p>And I repair the pluggable database:<\/p>\n<pre><code>\nRMAN&gt; repair pluggable database PDB01;\n&nbsp;\nStarting restore at 23-APR-17\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=203 device type=DISK\nExecuting: alter database datafile 21 offline\nExecuting: alter database datafile 22 offline\nExecuting: alter database datafile 23 offline\n&nbsp;\nchannel ORA_DISK_1: starting datafile backup set restore\nchannel ORA_DISK_1: specifying datafile(s) to restore from backup set\nchannel ORA_DISK_1: restoring datafile 00021 to \/u01\/oradata\/CDB2\/CDB2_SITE1\/46EA7EF707457B4FE0531416A8C027F2\/datafile\/o1_mf_system_d8k2t4wj_.dbf\nchannel ORA_DISK_1: restoring datafile 00022 to \/u01\/oradata\/CDB2\/CDB2_SITE1\/46EA7EF707457B4FE0531416A8C027F2\/datafile\/o1_mf_sysaux_d8k2t4wn_.dbf\nchannel ORA_DISK_1: restoring datafile 00023 to \/u01\/oradata\/CDB2\/CDB2_SITE1\/46EA7EF707457B4FE0531416A8C027F2\/datafile\/o1_mf_users_d8kbmy6w_.dbf\nchannel ORA_DISK_1: reading from backup piece \/u90\/fast_recovery_area\/CDB2_SITE1\/46EA7EF707457B4FE0531416A8C027F2\/backupset\/2017_04_23\/o1_mf_nnndf_B_dht2d4ow_.bkp\nchannel ORA_DISK_1: piece handle=\/u90\/fast_recovery_area\/CDB2_SITE1\/46EA7EF707457B4FE0531416A8C027F2\/backupset\/2017_04_23\/o1_mf_nnndf_B_dht2d4ow_.bkp tag=B\nchannel ORA_DISK_1: restored backup piece 1\nchannel ORA_DISK_1: restore complete, elapsed time: 00:00:35\nFinished restore at 23-APR-17\n&nbsp;\nStarting recover at 23-APR-17\nusing channel ORA_DISK_1\n&nbsp;\nstarting media recovery\nmedia recovery complete, elapsed time: 00:00:00\n&nbsp;\nExecuting: alter database datafile 21 online\nExecuting: alter database datafile 22 online\nExecuting: alter database datafile 23 online\nFinished recover at 23-APR-17\n<\/code><\/pre>\n<p>The good thing is that it automatically restores and recovers the datafiles with only one command.<br \/>\nBut we see here that all datafiles have been restored. AsI knew that only one datafile was corrupted, it would have been faster to use REPAIR DATAFILE for it.<\/p>\n<p>However, doing the same and calling the recovery advisor is not better: it advises to:<\/p>\n<pre><code>\n1      Restore and recover datafile 21; Restore and recover datafile 23; Recover datafile 22\n<\/code><\/pre>\n<p>When dealing with recovery, you need to understand how it works, what was the scope of the failure, and how to repair it. The advisors or automatic actions can help but do not alleviate the need to understand.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Franck Pachot . Do you know the RMAN Recovery advisor? It detects the problems, and then you: RMAN&gt; list failure; RMAN&gt; advise failure; RMAN&gt; repair failure; You need to have a failure detected. You can run Health Check if it was not detected automatically (see https:\/\/www.dbi-services.com\/blog\/oracle-12c-rman-list-failure-does-not-show-any-failure-even-if-there-is-one\/). In 12.2 you can run the repair directly, [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[198],"tags":[656,984,209,270],"type_dbi":[],"class_list":["post-9977","post","type-post","status-publish","format-standard","hentry","category-database-management","tag-12-2","tag-1z0-074","tag-oracle-12c","tag-rman"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>12cR2 RMAN&gt; REPAIR - dbi Blog<\/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.dbi-services.com\/blog\/12cr2-rman-repair\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"12cR2 RMAN&gt; REPAIR\" \/>\n<meta property=\"og:description\" content=\"By Franck Pachot . Do you know the RMAN Recovery advisor? It detects the problems, and then you: RMAN&gt; list failure; RMAN&gt; advise failure; RMAN&gt; repair failure; You need to have a failure detected. You can run Health Check if it was not detected automatically (see https:\/\/www.dbi-services.com\/blog\/oracle-12c-rman-list-failure-does-not-show-any-failure-even-if-there-is-one\/). In 12.2 you can run the repair directly, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-23T18:39:33+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\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\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"12cR2 RMAN&gt; REPAIR\",\"datePublished\":\"2017-04-23T18:39:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/\"},\"wordCount\":260,\"commentCount\":0,\"keywords\":[\"12.2\",\"1z0-074\",\"Oracle 12c\",\"RMAN\"],\"articleSection\":[\"Database management\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/\",\"name\":\"12cR2 RMAN&gt; REPAIR - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2017-04-23T18:39:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"12cR2 RMAN&gt; REPAIR\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"12cR2 RMAN&gt; REPAIR - dbi Blog","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.dbi-services.com\/blog\/12cr2-rman-repair\/","og_locale":"en_US","og_type":"article","og_title":"12cR2 RMAN&gt; REPAIR","og_description":"By Franck Pachot . Do you know the RMAN Recovery advisor? It detects the problems, and then you: RMAN&gt; list failure; RMAN&gt; advise failure; RMAN&gt; repair failure; You need to have a failure detected. You can run Health Check if it was not detected automatically (see https:\/\/www.dbi-services.com\/blog\/oracle-12c-rman-list-failure-does-not-show-any-failure-even-if-there-is-one\/). In 12.2 you can run the repair directly, [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/","og_site_name":"dbi Blog","article_published_time":"2017-04-23T18:39:33+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"12cR2 RMAN&gt; REPAIR","datePublished":"2017-04-23T18:39:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/"},"wordCount":260,"commentCount":0,"keywords":["12.2","1z0-074","Oracle 12c","RMAN"],"articleSection":["Database management"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/","url":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/","name":"12cR2 RMAN&gt; REPAIR - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2017-04-23T18:39:33+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/12cr2-rman-repair\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"12cR2 RMAN&gt; REPAIR"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=9977"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9977\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=9977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=9977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=9977"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=9977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}