{"id":728,"date":"2014-08-21T11:10:23","date_gmt":"2014-08-21T11:10:23","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=728"},"modified":"2014-09-20T12:19:18","modified_gmt":"2014-09-20T12:19:18","slug":"restoring-to-a-different-asm-diskgroup","status":"publish","type":"post","link":"https:\/\/www.theSQLReport.com\/?p=728","title":{"rendered":"Restoring to a Different ASM Diskgroup"},"content":{"rendered":"<p>Recently, I wanted to restore my Oracle database on a different server in a different ASM diskgroup.\u00a0 Sounds simple but I was tripped up on the syntax.<\/p>\n<p>Before I started the restore, I did the following:<\/p>\n<p>1. Started RMAN &amp; connected to the target.<\/p>\n<p>2. Started the database nomount using the pfile.<\/p>\n<p>3. Restored the control file.<\/p>\n<p>4. Mounted the database.<\/p>\n<p>Depending on your situation, you may or may not need to perform the steps above.\u00a0 I wanted the database restore to write my files to a another ASM diskgroup that was named &#8216;NEW&#8217;.\u00a0 For each file number in the database, a line has to let the restore where that file number is to moving to in the new ASM diskgroup.<\/p>\n<p>SET NEWNAME FOR DATAFILE &lt; file # &gt; TO\u00a0 &lt; new ASM diskgroup &gt;;<\/p>\n<p>For the destination, you only need to select the name of the diskgroup.\u00a0 You do not have to tell the ASM the full path.\u00a0 The ASM will handle it from that point.\u00a0 I had a problem because I attempted to put the full path of the files including directories &amp; sub directories like with flat files.<\/p>\n<p>If you do not know all the datafile numbers, once the controlfile is restored, you can open a sqlplus session to find out the datafile information with a query like: SELECT FILE#, NAME FROM V$DATAFILE;<\/p>\n<p>You will have to add the statement &#8220;SWITCH DATAFILE ALL&#8221; after the restore statement &amp; before the recovery statement.<\/p>\n<p>5. Now I am ready to run my restore &amp; recovery statements.\u00a0 Please note if you are using a tape system for the restore, you may have to allocate channels too.\u00a0 Below I am using the example database that comes with the Oracle installation.<\/p>\n<pre>RUN{\r\n SET NEWNAME FOR DATAFILE 1 TO '+NEW';\r\n SET NEWNAME FOR DATAFILE 2 TO '+NEW';\r\n SET NEWNAME FOR DATAFILE 3 TO '+NEW';\r\n SET NEWNAME FOR DATAFILE 4 TO '+NEW';\r\n SET NEWNAME FOR DATAFILE 5 TO '+NEW';\r\n RESTORE DATABASE;\r\n SWITCH DATAFILE ALL;\r\n RECOVER DATABASE;\r\n }<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM01.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-729 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM01.jpg\" alt=\"RestoreNewASM01\" width=\"499\" height=\"651\" \/><\/a><\/p>\n<p>Note: I could not get all of the restore text in one screen shot, so I broke it up into two screen shots.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM02.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-731 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM02.jpg\" alt=\"RestoreNewASM02\" width=\"987\" height=\"705\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM02.jpg 987w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM02-300x214.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/RestoreNewASM02-210x150.jpg 210w\" sizes=\"(max-width: 987px) 100vw, 987px\" \/><\/a><\/p>\n<p>When the restore &amp; recovery was finished, I ran the &#8216;alter database open resetlogs&#8217; statement.<\/p>\n<p>&nbsp;<\/p>\n<p>Added Note: Below is a screen shot of the of a recent restore moving not only the data files, but including the temp file &amp; redo logs to the ASM.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/MoveTempFileAndRedoLogs.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-774 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/MoveTempFileAndRedoLogs.jpg\" alt=\"MoveTempFileAndRedoLogs\" width=\"711\" height=\"243\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/MoveTempFileAndRedoLogs.jpg 711w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/MoveTempFileAndRedoLogs-300x102.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/08\/MoveTempFileAndRedoLogs-210x71.jpg 210w\" sizes=\"(max-width: 711px) 100vw, 711px\" \/><\/a>With the temp file, it was moved like a data file except I had to use the word TEMPFILE.\u00a0 Then after the restore statement, I had to include the &#8220;SWITCH TEMPFILE ALL;&#8221;.\u00a0 For the moving of the redo logs, it was a SQL statement executed with RMAN.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I wanted to restore my Oracle database on a different server in a different ASM diskgroup.\u00a0 Sounds simple but I was tripped up on the syntax. Before I started &hellip; <a class=\"readmore\" href=\"https:\/\/www.theSQLReport.com\/?p=728\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":729,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[22,63,23],"class_list":["post-728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-asm","tag-oracle","tag-restore"],"_links":{"self":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/728"}],"collection":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=728"}],"version-history":[{"count":15,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/728\/revisions"}],"predecessor-version":[{"id":777,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/728\/revisions\/777"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/729"}],"wp:attachment":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}