{"id":339,"date":"2024-07-20T19:35:58","date_gmt":"2024-07-20T19:35:58","guid":{"rendered":"https:\/\/humtechno.com\/intro\/?p=339"},"modified":"2024-09-21T09:27:27","modified_gmt":"2024-09-21T09:27:27","slug":"oracle-rman-backup-restore-linux","status":"publish","type":"post","link":"https:\/\/humtechno.com\/intro\/2024\/07\/20\/oracle-rman-backup-restore-linux\/","title":{"rendered":"Oracle RMAN Backup Restore (Linux)"},"content":{"rendered":"\n<p><a href=\"https:\/\/humtechno.com\/intro\/wp-content\/uploads\/2024\/07\/RMAN_Restore_V1.pdf\">Download<\/a> PDF<\/p>\n\n\n\n\n\n\n\n<h4 class=\"wp-block-heading\">Step 1 : Parameter Files not Exist its fresh RMAN Backup Restore on New Environment<\/h4>\n\n\n\n<p>export ORACLE_SID = mydb1<br>rman target \/<br>startup nomount;<br>Restore spfile from &#8216;\/backup\/backup\/c-1680948073-20210520-00&#8217;;<br>exit<br>sqlplus \/ as sysdba<br>create pfile from spfile;<\/p>\n\n\n\n<p><strong>Change Required Parameters File in Oracle Home dbs (Linux) or Database (Windows) Folder &#8220;initmydb1.ora&#8221;<\/strong><\/p>\n\n\n\n<p><strong>After Performed Changes in New Pfile execute below Steps<\/strong><\/p>\n\n\n\n<p>sqlplus \/ as sysdba<br>shutdown immediate;<br>startup nomount;<br>create spfile from Pfile;<br>shutdown immediate;<br>startup nomount;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2 : Restore Control file<\/h4>\n\n\n\n<p>rman target \/<br>restore controlfile from &#8216;\/backup\/backup\/master_200521\/c-1680948073-20210520-00&#8217;;<br>alter database mount;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3 : Catalog Backup<\/h4>\n\n\n\n<p>rman target \/<br>Crosscheck backup;<br>noprompt delete expired backup;<br>catalog start with &#8216;\/backup\/backup&#8217;;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 4 : Create script of Restore<\/h4>\n\n\n\n<p>If you want to restore on Non ASM File System and New File System of Data file below statement will generate Script and then you need to Change the Path<\/p>\n\n\n\n<p>sqlplus \/ as sysdba<br>set linesize 1000<br>set pagesize 10000<br>select &#8216;SET NEWNAME FOR DATAFILE &#8216; || file# || &#8216; TO &#8216; || &#8221;&#8221; || name || &#8221;&#8221; || &#8216;;&#8217; from v$datafile;<\/p>\n\n\n\n<p><strong>Restore Scripts<\/strong><\/p>\n\n\n\n<p>mkdir \/backup\/logs<br>mkdir \/backup\/scripts<br>vi \/backup\/scripts\/rman_restore.sh<\/p>\n\n\n\n<p>export ORACLE_SID=mydb<br>export ORACLE_HOME=\/u01\/app\/oracle\/19.2.0\/db_home1\/<br>export PATH = $PATH:$ORACLE_HOME<br>rman target \/ LOG=&#8217;\/backup\/logs\/rman_restore.log&#8217; &lt;&lt;EOF<br>run{<br>SET NEWNAME FOR DATAFILE 1 TO &#8216;\/data\/database\/mydb\/o1_mf_system_lvpwl674_.dbf&#8217;;<br>SET NEWNAME FOR DATAFILE 2 TO &#8216;\/data\/database\/mydb\/CISTS_01_1.dbf&#8217;;<br>SET NEWNAME FOR DATAFILE 3 TO &#8216;\/data\/database\/mydb\/o1_mf_sysaux_lvpwnvoc_.dbf&#8217;;restore database;<br>SWITCH DATAFILE ALL;<br>Recover database;<br>}<br>exit;<br>EOF<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 5 : Execute Restore<\/h4>\n\n\n\n<p><strong>Check Incarnation of Database it should be same as database which backup you are restoring<\/strong><\/p>\n\n\n\n<p>rman target \/<br>list incarnation of database;<\/p>\n\n\n\n<p><strong>If not Same then change Incarnation<\/strong><\/p>\n\n\n\n<p>rman target \/<br>RESET DATABASE TO INCARNATION 2;<\/p>\n\n\n\n<p>nohup sh \/backup\/scripts\/rman_restore.sh &amp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 6 : Monitoring RMAN<\/h4>\n\n\n\n<p>sqlplus \/ as sysdba<\/p>\n\n\n\n<p>SELECT round(( ( ( sofar ) \/ (totalwork) ) *100) ,10) &#8220;% Complete&#8221; FROM v$session_longops WHERE opname LIKE &#8216;RMAN%&#8217;<br>AND opname NOT LIKE &#8216;%aggregate%&#8217;<br>AND totalwork != 0;<\/p>\n\n\n\n<p>tail -f \/backup\/logs\/rman_restore.log<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 7 : Recover Database<\/h4>\n\n\n\n<p><strong>If Required to Restore Specific Archive Files (If Restore Database Complete but Error in Recovery no any archive Restore and Recover)<\/strong><\/p>\n\n\n\n<p>rman target \/<br>restore archivelog from sequence 72457 until sequence 72475 thread 1;<br>restore archivelog from sequence 72527 until sequence 72545 thread 2;<br>recover database;<br>or<br>sqlplus \/ as sysdba<br>recover database using backup control file until cancel;<br>enter &#8220;auto&#8221;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 8 : Change File Location<\/h4>\n\n\n\n<p><strong>Change Temp File and Redo Log File Path Before Opening Database by using SQL Script.<br><\/strong>sqlplus \/ as sysdba<br>select &#8216;Alter database rename file &#8216; || &#8221;&#8221; || member || &#8221;&#8221; || &#8216; to &#8216; || &#8221;&#8221; || member || &#8221;&#8221; || &#8216;;&#8217; from v$logfile;<br>select &#8216;Alter database rename file &#8216; || &#8221;&#8221; || name || &#8221;&#8221; || &#8216; to &#8216; || &#8221;&#8221; || name || &#8221;&#8221; || &#8216;;&#8217; from v$tempfile;<br>Alter database rename file &#8216;+PDATA\/T24PRODDB\/ONLINELOG\/group_64.838.1080826843&#8217; to &#8216;+DATA\/T24STG\/ONLINELOG\/group_64.838.1080826843&#8217;;<br>alter database rename file &#8216;+DATA\/T24STG\/B34E68EABF0501A0E0530AAC15194891\/TEMPFILE\/temp.864.1069657275&#8217; to &#8216;+PDATA\/T24PRODDB\/B34E68EABF0501A0E0530AAC15194891\/TEMPFILE\/temp.864.1069657275&#8217;;<\/p>\n\n\n\n<p><strong>Step 9 : Open Database in Reset Logs<br><\/strong>recover database using backup controlfile until cancel;<br>alter database open resetlogs;<br>shutdown immediate;<br>startup nomount;<br>if using wallet open wallet<br>alter database mount;<br>alter database open;<\/p>\n\n\n\n<p><strong>Step 10 : Disable RAC node if RAC to Single Database<br><\/strong>sqlplus \/ as sysdba<br>alter database enable thread 2;<\/p>\n\n\n\n<p><strong>Step 11 : If using Container Databases<br><\/strong>sqlplus \/ as sysdba<br>ALTER PLUGGABLE DATABASE all open;<br>ALTER PLUGGABLE DATABASE ALL SAVE STATE;<\/p>\n\n\n\n<p><strong>Step 12 : Check and Create temporary Tablespace<br><\/strong>sqlplus \/ as sysdba<br>SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME = &#8216;DEFAULT_TEMP_TABLESPACE&#8217;;<br>CREATE TEMPORARY TABLESPACE TEMP_02 TEMPFILE &#8216;\/data\/database\/t24stgdr3\/temp_02.dbf&#8217; SIZE 500m autoextend on next 10m maxsize unlimited;<\/p>\n\n\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download PDF<\/p>\n","protected":false},"author":1,"featured_media":333,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[3],"tags":[23,24,25],"class_list":["post-339","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-oracle-database-restore","tag-restore-database","tag-rman-restore"],"_links":{"self":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/comments?post=339"}],"version-history":[{"count":11,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/339\/revisions"}],"predecessor-version":[{"id":533,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/339\/revisions\/533"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media\/333"}],"wp:attachment":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media?parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/categories?post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/tags?post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}