{"id":2466,"date":"2012-08-23T19:17:05","date_gmt":"2012-08-24T00:17:05","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=2466"},"modified":"2012-08-26T21:35:21","modified_gmt":"2012-08-27T02:35:21","slug":"rman-recover-with-backup-taken-before-resetlogs","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2012\/08\/23\/rman-recover-with-backup-taken-before-resetlogs\/","title":{"rendered":"RMAN recover with backup taken before RESETLOGS"},"content":{"rendered":"<p>This functionality has been available since the early 10 release, but I am embarassed to say I have never tested it.<\/p>\n<p>Of course, you know where this is going.  Last Friday evening, we took a full QA database backup.  Over the weekend, some developer activity trashed a lot of the data.  When I came in on Monday, we were asked to restore the database to its state as of early Saturday morning.  &#8220;No problem&#8221;, we replied.  This, we had done many times before, pretty standard stuff.  We restored and recovered the database, and everyone was happy.  I had this gnawing thought in the back of my head to take another backup, but then I thought, &#8220;you can always recover through a RESETLOGS with previous backups&#8221;, so I pushed the thought out and went on my way.<\/p>\n<p>This afternoon I got a text saying, &#8220;hey, that problem we had over the weekend?  we had it again last night.  we need to restore to 9PM Wednesday evening.&#8221;<\/p>\n<p>I thought, &#8220;Well, I hope this works&#8221;.<\/p>\n<p>if you are looking for the short answer, all I did was the following:<\/p>\n<pre lang=\"text\">\r\n#at the shell...\r\nexport NLS_LANG=\"AMERICAN_AMERICA.AL32UTF8\"\r\nexport NLS_DATE_FORMAT=\"YYYY-MM-DD HH24:MI:SS\"\r\n\r\n#...and in RMAN...\r\nrun {\r\n  set until time '2012-08-22 21:00:00';\r\n  allocate channel t1 device type 'sbt_tape';\r\n  allocate channel t2 device type 'sbt_tape';\r\n  allocate channel t3 device type 'sbt_tape';\r\n  allocate channel t4 device type 'sbt_tape';\r\n  allocate channel t5 device type 'sbt_tape';\r\n  restore database;\r\n  recover database delete archivelog maxsize 25g;\r\n  release channel t1;\r\n  release channel t2;\r\n  release channel t3;\r\n  release channel t4;\r\n  release channel t5;\r\n}\r\n<\/pre>\n<p>What I found was that it was &#8220;smart&#8221; enough to restore the first backup, apply all the logs until the first resetlogs operation, and then start applying the ones starting at sequence 1 after the resetlogs operation.<\/p>\n<p>Good stuff!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This functionality has been available since the early 10 release, but I am embarassed to say I have never tested it. Of course, you know where this is going. Last Friday evening, we took a full QA database backup. Over&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2012\/08\/23\/rman-recover-with-backup-taken-before-resetlogs\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2466"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2466"}],"version-history":[{"count":13,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2466\/revisions"}],"predecessor-version":[{"id":2486,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2466\/revisions\/2486"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2466"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}