
{"id":7835,"date":"2020-12-23T12:09:43","date_gmt":"2020-12-23T12:09:43","guid":{"rendered":"https:\/\/rax-stg-wp-aws.com\/blogs\/restore-oracle-database-by-using-rman-duplicate-in-oracle-12c\/"},"modified":"2026-11-06T12:08:23","modified_gmt":"2026-11-06T12:08:23","slug":"restore-oracle-database-by-using-rman-duplicate-in-oracle-12c","status":"publish","type":"blogs","link":"https:\/\/www.rackspace.com\/de\/blogs\/restore-oracle-database-by-using-rman-duplicate-in-oracle-12c\/","title":{"rendered":"Restore Oracle database by using RMAN duplicate in Oracle 12c"},"content":{"rendered":"<p><strong>Introduction<\/strong><\/p>\n<p>Oracle\u00ae Recovery Manager (RMAN) is a tool that can duplicate or clone a\u00a0database from a backup or from an active database. RMAN can create a duplicate\u00a0database on a remote server with the same file structure, on a remote\u00a0server with a different file structure, or on a local server with a\u00a0different file structure. Recovery Manager (RMAN) is a tool that can duplicate or clone a\u00a0database from a backup or from an active database. RMAN can create a duplicate\u00a0database on a remote server with the same file structure, on a remote\u00a0server with a different file structure, or on a local server with a\u00a0different file structure.<\/p>\n<p>When you receive any request to refresh the Oracle target database from any\u00a0source available:<\/p>\n<ul>\n<li>First, ask the application team for the backup location of the\u00a0\u00a0 source database, if they had previously asked to preserve any backup of the\u00a0\u00a0 source database. If an existing backup is not available, then confirm with\u00a0the\u00a0 application team if you need to back up the source database now when\u00a0the request comes in. After you&#8217;ve confirmed when to take a backup, you can\u00a0use the following script to back up the source database.<\/li>\n<li>Ask the application team to provide any specific post-refresh tasks.<\/li>\n<li>Transfer the source backup to the target server in your specific location.<\/li>\n<\/ul>\n<p>If the source database must continue to run while being backed up, use the\u00a0script for a <em>hot backup<\/em>. If the source database is able to stop running\u00a0for the backup, use the script for a <em>cold backup<\/em>.<\/p>\n<p>Create a new file called <strong>rman_full_HOT_DATABASENAME.sh<\/strong>\u00a0and paste the\u00a0following script into it:<\/p>\n<p><em>\u00a0 \u00a0 export ORACLE_HOME=Correct_ORACLE_HOME<br \/>\nexport ORACLE_SID=Correct_ ORACLE SID<br \/>\nexport PATH=$PATH:$ORACLE_HOME\/bin<br \/>\nexport LOG=Correct_ Log_Loaction\/rman_HOT_DATABASENAME_backup.log<br \/>\nrman target \/ &lt;&lt;EOF&gt;&gt;$LOG<br \/>\nrun<br \/>\n{<br \/>\nallocate channel ch1 type disk maxpiecesize 4048M format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_HOT_backup_%U.bak&#8217;;<br \/>\nallocate channel ch2 type disk maxpiecesize 4048M format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_HOT_backup_%U.bak&#8217;;<br \/>\nallocate channel ch3 type disk maxpiecesize 4048M format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_HOT_backup_%U.bak&#8217;;<br \/>\nbackup as compressed backupset database TAG &#8216;DONOTDELETE_ITKnumber&#8217;;<br \/>\nbackup AS COMPRESSED BACKUPSET archivelog all format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_ARC_BACKUP_%d_%u_%p_%s.bak&#8217;;<br \/>\nbackup current controlfile format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_HOT_backup_CTL_%d%s%t_%U.bak&#8217;;<br \/>\nrelease channel ch1;<br \/>\nrelease channel ch2;<br \/>\nrelease channel ch3;<br \/>\n}<br \/>\nexit<br \/>\nEOF<\/em><\/p>\n<p>Use the following command to run the script:<\/p>\n<p><em>\u00a0 \u00a0 $ nohup sh rman_full_HOT_DATABASENAME.sh &amp;<\/em><\/p>\n<p><strong>Cold backup<\/strong><\/p>\n<p><strong>**Note**: <\/strong>For a cold backup, there is no need to take a backup of the archive\u00a0log and the application should be down before starting the backup process.<\/p>\n<p>Create a new file called <strong>rman_full_COLD_DATABASENAME.sh<\/strong>\u00a0and paste the\u00a0following script into it:<\/p>\n<p><em>\u00a0 export ORACLE_HOME=Correct_ORACLE_HOME<br \/>\nexport ORACLE_SID=Correct_ORACLE_SID<br \/>\nexport PATH=$PATH:$ORACLE_HOME\/bin<br \/>\nexport LOG=Correct Log Loaction\/rman_COLD_DATABASENAME_backup.log<br \/>\nrman target \/ &lt;&lt;EOF&gt;&gt;$LOG<br \/>\nrun<br \/>\n{<br \/>\nallocate channel ch1 type disk maxpiecesize 4048M format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_COLD_backup_%U.bak&#8217;;<br \/>\nallocate channel ch2 type disk maxpiecesize 4048M format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_COLD_backup_%U.bak&#8217;;<br \/>\nallocate channel ch3 type disk maxpiecesize 4048M format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_COLD_backup_%U.bak&#8217;;<br \/>\nbackup as compressed backupset database TAG &#8216;ticketnumber&#8217;;<br \/>\nbackup current controlfile format &#8216;\/backup\/RMAN\/DATABASENAME\/DATABASENAME_COLD_backup_CTL_%d%s%t_%U.bak&#8217;;<br \/>\nrelease channel ch1;<br \/>\nrelease channel ch2;<br \/>\nrelease channel ch3;<br \/>\n}<br \/>\nexit<br \/>\nEOF<\/em><\/p>\n<p>Use the following command to run the script:<\/p>\n<p><em>\u00a0 \u00a0 $ nohup sh rman_full_COLD_DATABASENAME.sh &amp;<\/em><\/p>\n<p><strong>\u00a0Pre-refresh tasks<\/strong><\/p>\n<p>Now you can perform the following re-refresh tasks on the target database:<\/p>\n<ul>\n<li>Preserve all SQL profiles<\/li>\n<li>Preserve all DB links<\/li>\n<li>Preserve all synonyms<\/li>\n<li>Preserve all user passwords<\/li>\n<li>Preserve all grant\/object, Grant\/system, and Grant\/roles<\/li>\n<li>Preserve all general information<\/li>\n<li>Copy pfile and spfile in the specific directory per your requirement<\/li>\n<li>Edit the correct value for the `logfile_name_convert` parameter and the<em>`db_file_name_convert`<\/em> parameter. Also check the value of `<em>undo_tablespace`\u00a0<\/em>and make sure that it is defined the same in the target as the source\u00a0database.<\/li>\n<li>Prepare the script to clone the database<\/li>\n<\/ul>\n<p><strong>\u00a0Preserve all SQL profiles\u00a0<\/strong><\/p>\n<p>First, check whether any SQL profiles are present on the target database by\u00a0using the following command:<\/p>\n<p><em>\u00a0 \u00a0 SQL&gt; select count(*) from dba_sql_profiles;<\/em><\/p>\n<p>If the <strong>count<\/strong>\u00a0is zero, then you don&#8217;t need to perform the following steps\u00a0to preserve SQL profiles. If the **count** is more than zero, then SQL\u00a0profiles are present and you need to preserve them by using the following\u00a0steps:<\/p>\n<p><strong>Step 1<\/strong><\/p>\n<p><em>\u00a0 \u00a0 grant dba to TEST identified by password;<\/em><\/p>\n<p><strong>Step 2<\/strong><\/p>\n<p><em>\u00a0 \u00a0 CONN TEST\/password<\/em><\/p>\n<p><strong>Step 3<\/strong><\/p>\n<p><em>\u00a0 \u00a0 BEGIN<br \/>\nDBMS_SQLTUNE.CREATE_STGTAB_SQLPROF (table_name =&gt; &#8216;SQL_PROFILES3&#8242;,schema_name=&gt;&#8217;SYSTEM&#8217;);<br \/>\nEND;<br \/>\n\/<\/em><\/p>\n<p><strong>Step 4<\/strong><\/p>\n<p><em>\u00a0 \u00a0 BEGIN<br \/>\nDBMS_SQLTUNE.PACK_STGTAB_SQLPROF<br \/>\n(profile_category =&gt; &#8216;%&#8217;,<br \/>\nstaging_table_name =&gt; &#8216;SQL_PROFILES3&#8242;,<br \/>\nstaging_schema_owner=&gt;&#8217;SYSTEM&#8217;);<br \/>\nEND;<br \/>\n\/<\/em><\/p>\n<p><strong>Step 5<\/strong><\/p>\n<p><em>\u00a0 \u00a0 select count(*) from SYSTEM.sql_profiles3;<\/em><\/p>\n<p><strong>Step 6<\/strong><\/p>\n<p><em>\u00a0 \u00a0 expdp TEST\/password directory=expdp \u00a0dumpfile=expdp_sql_profiles.dmp TABLES=SYSTEM.SQL_PROFILES3 logfile=expdp_sql_profiles.log<\/em><\/p>\n<p><strong>\u00a0Import and unpack SQL profiles<\/strong><\/p>\n<p>Use the following steps to import and then unpack the SQL profiles:<\/p>\n<p><strong>Note<\/strong>: After the target database is restored, you must perform the following\u00a0steps in the target database.<\/p>\n<p><strong>Step 1<\/strong><\/p>\n<p><em>\u00a0 \u00a0 grant dba to TEST identified by password;<\/em><\/p>\n<p><strong>Step 2<\/strong><\/p>\n<p><em>\u00a0 \u00a0 impdp TEST\/password dumpfile=expdp_sql_profiles.dmp TABLES=SYSTEM.SQL_PROFILES3 DIRECTORY=expdp TABLE_EXISTS_ACTION=REPLACE logfile=impdp_sql_profiles.log<\/em><\/p>\n<p><strong>Step 3<\/strong><\/p>\n<p><em>\u00a0 \u00a0 BEGIN<br \/>\nDBMS_SQLTUNE.UNPACK_STGTAB_SQLPROF<br \/>\n(staging_table_name =&gt; &#8216;SQL_PROFILES3&#8242;,<br \/>\nstaging_schema_owner=&gt;&#8217;SYSTEM&#8217;, replace=&gt;TRUE);<br \/>\nEND;<br \/>\n\/<\/em><\/p>\n<p><strong>\u00a0Preserve all DB links<\/strong><\/p>\n<p>Create a file called <strong>dblink.sh<\/strong>\u00a0and paste the following script into it:<\/p>\n<p><em>\u00a0 \u00a0 export ORACLE_HOME=Correct _ORACLE_HOME<br \/>\nexport ORACLE_SID=Correct_ ORACLE_SID<br \/>\nexpdp \u00a0\\&#8217;\/ as sysdba\\&#8217; directory=expdp \u00a0dumpfile=dblink.dmp full=y content=metadata_only include=db_link \u00a0logfile=expdp_dblink.log<\/em><\/p>\n<p>Then run the following command to execute the script:<\/p>\n<p><em>\u00a0 \u00a0 $ nohup sh dblink.sh &amp;<\/em><\/p>\n<p><strong>Preserve all synonyms<\/strong><\/p>\n<p>Create a file called <strong>Synonyms_query.sql\u00a0<\/strong>and paste the following SQL script<br \/>\ninto it:<\/p>\n<p><em>\u00a0Spool synonyms.sql<br \/>\nset pages 10000<br \/>\nset long 999999<br \/>\nset linesize 450<br \/>\nSELECT DBMS_METADATA.GET_DDL(&#8216;SYNONYM&#8217;, SYNONYM_NAME, OWNER) || &#8216;;&#8217; \u00a0&#8220;output&#8221; FROM dba_synonyms where table_owner not in(&#8216;SYS&#8217;,&#8217;SYSTEM&#8217;,&#8217;DBSNMP&#8217;,&#8217;ORACLE_OCM&#8217;,&#8217;MDSYS&#8217;,&#8217;OLAPSYS&#8217;,&#8217;ORDSYS&#8217;,&#8217;WMSYS&#8217;,&#8217;ANONYMOUS&#8217;,&#8217;CTXSYS&#8217;,&#8217;OUTLN&#8217;,&#8217;SI_INFORMTN_SCHEMA&#8217;,&#8217;SYSMAN&#8217;,&#8217;EXFSYS&#8217;,&#8217;XDB&#8217;,&#8217;DMSYS&#8217;);<\/em><\/p>\n<p><em>\u00a0 \u00a0 Spool off<\/em><\/p>\n<p>Then run the following command to execute the script:<\/p>\n<p><em>\u00a0 \u00a0 $ nohup sqlplus \/ as sysdba @Synonyms_query.sql &gt; Synonyms_query.log &amp;<\/em><\/p>\n<p><strong>Export method<\/strong><\/p>\n<p>Create a file called <strong>synonyms.sh<\/strong>\u00a0and paste the following script into it:<\/p>\n<p><em>\u00a0 \u00a0 export ORACLE_HOME=Correct ORACLE HOME<br \/>\nexport ORACLE_SID=Correct_ORACLE SID<br \/>\nexpdp \\&#8217;\/ as sysdba\\&#8217; directory=expdp dumpfile=SYNONYMS.dmp logfile=expdp_SYNONYMS.log FULL=y CONTENT=METADATA_ONLY INCLUDE=PUBLIC_SYNONYM\/SYNONYM<\/em><\/p>\n<p>Then run the following command to execute the script:<\/p>\n<p><em>\u00a0 \u00a0 $ nohup sh synonyms.sh &amp;<\/em><\/p>\n<p><strong>Preserve all user passwords<\/strong><\/p>\n<p>Create a file called <strong>usders_password.sql<\/strong>\u00a0and paste the following script\u00a0into it:<\/p>\n<p><em>Spool password.sql<\/em><\/p>\n<p><em>\u00a0 \u00a0 COL ColumnName FORMAT A32000<br \/>\nset pagesize 2000<br \/>\nset pages 0<br \/>\ncolumn output format a300<br \/>\nset line 300<br \/>\nset long 100000<br \/>\nselect<br \/>\n&#8216;alter user &#8216;||u.username||&#8217; identified by values &#8221;&#8217;||s.spare4||&#8221;&#8217;;&#8217; cmd<br \/>\nfrom dba_users u<br \/>\njoin sys.user$ s<br \/>\non u.user_id = s.user#<br \/>\nwhere u.username in (select username from dba_users where ORACLE_MAINTAINED=&#8217;N&#8217;)<br \/>\n\/<\/em><\/p>\n<p><em>\u00a0 \u00a0 Spool off<\/em><\/p>\n<p>Then run the following command to execute the script:<\/p>\n<p><em>\u00a0$ nohup sqlplus \/ as sysdba @usders_password.sql &gt; usders_password.log &amp;<\/em><\/p>\n<p><strong>Preserve all grant\/object, Grant\/system, and Grant\/roles<\/strong><\/p>\n<p>Create a file called <strong>grant.sh<\/strong>\u00a0and paste the following script into it:<\/p>\n<p><em>\u00a0 \u00a0 export ORACLE_HOME=Correct_ORACLE HOME<br \/>\nexport ORACLE_SID=Correct_ORACLE SID<br \/>\nexpdp \\&#8217;\/ as sysdba\\&#8217; directory= expdp \u00a0dumpfile=URG.dmp logfile=expdp_URG.log FULL=y CONTENT=METADATA_ONLY INCLUDE=USER,ROLE,ROLE_GRANT,PROFILE<\/em><\/p>\n<p>Then run the following command to execute the script:<\/p>\n<p><em> \u00a0 $ nohup sh grant.sh &amp;<\/em><\/p>\n<p><strong>Preserve all general information<\/strong><\/p>\n<p>Create a file called <strong>prerefresh.sql<\/strong> and paste the following script into it:<\/p>\n<p><strong>Note<\/strong>: Change <em>`correct_location<\/em>` as per your requirement.<\/p>\n<p><em>\u00a0 spool pre_clone_info_$ORACLE_SID.log<\/em><\/p>\n<p><em>\u00a0 \u00a0 alter database backup controlfile to trace as &#8216;correct_loactionlocation\/ctrl$ORACLE_SID.sql&#8217;;<\/em><\/p>\n<p><em>\u00a0 \u00a0 SELECT name,database_role, open_mode FROM v$database;<\/em><\/p>\n<p><em>\u00a0 \u00a0 &#8212; select name,open_mode from v$pdbs;<\/em><\/p>\n<p><em>\u00a0 \u00a0 archive log list<\/em><\/p>\n<p><em>\u00a0 \u00a0 show parameter pfile<\/em><\/p>\n<p><em>\u00a0 \u00a0 show parameter control_files<\/em><\/p>\n<p><em>\u00a0 \u00a0 set pages 10000<br \/>\nset serveroutput on size 1000000 long 1000000<br \/>\nSELECT DBMS_METADATA.GET_DDL(&#8216;DB_LINK&#8217;,a.db_link,a.owner) || &#8216;;&#8217; &#8220;output&#8221; FROM dba_db_links a;<\/em><\/p>\n<p><em>\u00a0 \u00a0 col OWNER for a20<br \/>\ncol DB_LINK for a25<br \/>\ncol USERNAME for a20<br \/>\ncol HOST for a35<br \/>\nselect * from dba_db_links;<\/em><\/p>\n<p><em>\u00a0 \u00a0 set lines 200<br \/>\ncol DIRECTORY_NAME for a40<br \/>\ncol DIRECTORY_PATH for a110<br \/>\nselect * from dba_directories;<\/em><\/p>\n<p><em>\u00a0 \u00a0 select &#8216;create or replace directory &#8216;||DIRECTORY_NAME||&#8217; as &#8221;&#8217;||DIRECTORY_PATH||&#8221;&#8217;;&#8217; from dba_directories;<\/em><\/p>\n<p><em>\u00a0 \u00a0 set long 20000 longchunksize 20000 pagesize 0 linesize 1000 feedback off verify off trimspool on<\/em><\/p>\n<p><em>\u00a0 \u00a0 set lines 300 pages 200<br \/>\ncol FILE_NAME for a60;<br \/>\nselect file_name,tablespace_name,bytes\/1024\/1024,status from dba_data_files;<br \/>\nselect file_name,tablespace_name,bytes\/1024\/1024,status from dba_temp_files;<br \/>\nselect tablespace_name from dba_tablespaces;<\/em><\/p>\n<p><em>\u00a0 \u00a0 set lines 300<br \/>\nselect username from dba_users;<\/em><\/p>\n<p><em>\u00a0 \u00a0 select name from v$controlfile;<\/em><\/p>\n<p><em>\u00a0 \u00a0 set lines 200 pages 200<br \/>\nselect * from v$logfile;<br \/>\nselect * from v$log;<\/em><\/p>\n<p><em>\u00a0 \u00a0 select substr(name,1,instr(name,&#8217;\/&#8217;,-1)) from v$datafile<br \/>\nunion<br \/>\nselect substr(name,1,instr(name,&#8217;\/&#8217;,-1)) from v$tempfile<br \/>\nunion<br \/>\nselect substr(member,1,instr(member,&#8217;\/&#8217;,-1)) from v$logfile<br \/>\nunion<br \/>\nselect substr(name,1,instr(name,&#8217;\/&#8217;,-1)) from v$controlfile;<\/em><\/p>\n<p><em>\u00a0 \u00a0 show parameter utl<\/em><\/p>\n<p><em>\u00a0 \u00a0 spool off<\/em><br \/>\nThen run the following command to execute the script:<\/p>\n<p><em>\u00a0 \u00a0 $ nohup sqlplus \/ as sysdba @prerefresh.sql &gt; prerefresh.log &amp;<\/em><\/p>\n<p><strong>Copy pfile and spfile<\/strong><\/p>\n<p>Copy the <strong>pfile<\/strong>\u00a0and <strong>spfile<\/strong>\u00a0from the source database. You need to\u00a0edit the correct value for the `<em>logfile_name_convert<\/em>` and<br \/>\n<em>`db_file_name_convert<\/em>` parameters then also check the value of\u00a0<em>`undo_tablespace`.<\/em><\/p>\n<p>Use the following query on the source database and the target database:<\/p>\n<p><em>\u00a0 \u00a0 set lines 200 pages 200<br \/>\nselect distinct substr(name,1,instr(name,&#8217;\/&#8217;,-1)) from v$datafile;<br \/>\nselect distinct substr(member,1,instr(member,&#8217;\/&#8217;,-1)) from v$logfile;<\/em><\/p>\n<p>According to the output you receive, edit the following parameters in the<br \/>\n<strong>pfile<\/strong>\u00a0that you copied with your specific requirements:<\/p>\n<p><strong>Note:<\/strong> Be sure to take a backup of the original <strong>pfile<\/strong> before making\u00a0any changes.<\/p>\n<p><em>\u00a0 \u00a0.db_file_name_convert=&#8217;path1_of_source_datafile&#8217;,\u2019path1_of_trget_datafile\u2019, &#8216;path2_of_source_datafile&#8217;,\u2019path2_of_trget_datafile\u2019,<br \/>\n*.log_file_name_convert=&#8217;path1_of_source_logile&#8217;,\u2019path1_of_trget_logfile, &#8216;path2_of_source_logfile&#8217;,\u2019path2_of_trget_logfile\u2019,<\/em><\/p>\n<p>Next, check the parameter `<em>undo_tablespace<\/em>` in both the source and target\u00a0databases by using the following command:<\/p>\n<p><em>\u00a0 \u00a0 SQL&gt; show parameters undo_tablespace<\/em><\/p>\n<p>If the output is different in the target database, you must update the\u00a0`<em>undo_tablespace<\/em>` parameter to match the value in the source database.<\/p>\n<p><strong>\u00a0Prepare a script to clone the database<\/strong><\/p>\n<p><strong>If you used a hot backup<\/strong><\/p>\n<p>Create a file called <strong>rman_dup.sh<\/strong>\u00a0and paste the following script into it:<\/p>\n<p><em>\u00a0 \u00a0 export ORACLE_HOME=Correct_ORACLE_HOME<br \/>\nexport ORACLE_SID=Correct_ORACLE SID<br \/>\nexport PATH=$ORACLE_HOME\/bin:$PATH<br \/>\nrman AUXILIARY \/ cmdfile=rman_duplicate_script.scr msglog=rman_duplicate_script.log<\/em><\/p>\n<p>Next, create another new file called <strong>rman_duplicate_script.scr<\/strong>\u00a0and paste<br \/>\nthe following script into it:<\/p>\n<p><em>\u00a0 run {<br \/>\nallocate auxiliary channel aux1 device type disk;<br \/>\nallocate auxiliary channel aux2 device type disk;<br \/>\nallocate auxiliary channel aux3 device type disk;<br \/>\nDUPLICATE DATABASE TO Target_db_name BACKUP LOCATION &#8216;Loaction_of_backup_of_source database&#8217; nofilenamecheck;<br \/>\nrelease channel aux1;<br \/>\nrelease channel aux2;<br \/>\nrelease channel aux3;<br \/>\n}<\/em><\/p>\n<p><strong>If you used a cold backup<\/strong><\/p>\n<p>Create a file called <strong>rman_dup.sh<\/strong>\u00a0and paste the following script into it:<\/p>\n<p><em>\u00a0 \u00a0 export ORACLE_HOME=Correct_ORACLE_HOME<br \/>\nexport ORACLE_SID=Correct_ORACLE SID<br \/>\nexport PATH=$ORACLE_HOME\/bin:$PATH<br \/>\nrman AUXILIARY \/ cmdfile=rman_duplicate_script.scr msglog=rman_duplicate_script.log<\/em><br \/>\nNext, create another new file called <strong>rman_duplicate_script.scr<\/strong>\u00a0and paste\u00a0the following script into it:<\/p>\n<p><em>\u00a0 \u00a0 run {<br \/>\nallocate auxiliary channel aux1 device type disk;<br \/>\nallocate auxiliary channel aux2 device type disk;<br \/>\nallocate auxiliary channel aux3 device type disk;<br \/>\nallocate auxiliary channel aux9 device type disk;<br \/>\nDUPLICATE DATABASE TO Target_db_name BACKUP BACKUP LOCATION &#8216;Loaction_of_backup_of_source database&#8217; nofilenamecheck noredo;<br \/>\nrelease channel aux1;<br \/>\nrelease channel aux2;<br \/>\nrelease channel aux3;<\/em><br \/>\n}<\/p>\n<p><strong>Start the target database<\/strong><\/p>\n<p>Start the target database<\/p>\n<p>Start the target database by using the following steps:<\/p>\n<p>1. Use the following command to start the target database in the mount mode by<br \/>\nusing restrict:<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0SQL&gt; startup mount restrict;<\/em><\/p>\n<p>2. Next, drop the target database by using the following command:<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0SQL&gt; DROP DATABASE<\/em><\/p>\n<p><strong>Note:<\/strong> Before dropping the target database, be sure the application is\u00a0\u00a0 \u00a0down or you have the proper go-ahead from the application. Reach out to the\u00a0application team if you aren&#8217;t sure.<\/p>\n<p>3. Start the target database in nomount mode using the <strong>pfile<\/strong> that you edited\u00a0with the correct <em>do_file_name_convert<\/em>, <em>log_file_name_convert<\/em>, and\u00a0<em>undo_tablespace<\/em>` parameters.<\/p>\n<p>4. Verify the parameters in the target database by using the following commands:<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0show parameter db_file<br \/>\nshow parameter log_file<br \/>\nshow parameter db_name<br \/>\nshow parameter undo<\/em><\/p>\n<p>5. Use the script that you created in the previous section to clone the database<br \/>\nand check the log:<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0$ nohup sh rman_dup.sh &amp;<\/em><\/p>\n<p>6. After the cloning process is complete, open the database in read\/write mode.<br \/>\nShut down the target database and copy the original <strong>pfile\u00a0<\/strong>and <strong>spfile<\/strong><br \/>\nat the default location (<strong>$ORACLE_HOME\/dbs<\/strong>).<\/p>\n<p>7. Start the target database again and check the parameters showing the parameter<br \/>\n`<em>spfile`<\/em>. It should point to the default location.<\/p>\n<p>8. Start the post-refresh tasks.<\/p>\n<p><strong>Post-refresh tasks<\/strong><\/p>\n<p>Use the following steps after you refresh the database:<\/p>\n<p>1. Import SQL profiles by using the steps in the<br \/>\nImport and unpack the SQL profiles\u00a0section.<\/p>\n<p>2. Import DB links.<\/p>\n<p>Before you import the DB links, be sure to remove all private and public\u00a0\u00a0 \u00a0DB links from the target database. Use the dump file that you preserved in the Preserve all DB links\u00a0section.<\/p>\n<p>For example:<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0impdp \u00a0\\&#8217;\/ as sysdba\\&#8217; directory=expdp \u00a0dumpfile=dblink.dmp logfile=impdp_dblink.log<\/em><\/p>\n<p>3. Reset the passwords of all users to the passwords that you preserved from\u00a0the source database.<\/p>\n<p>4. Hand over the database to the application team.<\/p>\n<p><strong>Conclusion<\/strong><br \/>\nWith the help of this blog you can easily clone your Oracle database by using\u00a0RMAN duplicate. RMAN duplicate not only makes your work very easy but\u00a0faster as well. The steps explained above can duplicate your database\u00a0using any backup. However, it is important to note that the above\u00a0steps do not explain duplicating databases by using the ACTIVE database method.<\/p>\n<p><a href=\"https:\/\/oracle-base.com\/articles\/11g\/duplicate-database-using-rman-11gr2\"><em><strong>Reference<\/strong><\/em><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Restore Oracle database by using RMAN duplicate in Oracle 12c<\/p>\n","protected":false},"author":2,"featured_media":7837,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":{"content-type":"","nid":"26512","content_type":"blog","created_by":"10130","authored_on":"2024-01-18T12:09:43+00:00","field_article_industries":"","tag_category":"Technical","field_blog_author_text":"by Pradeep Rai, Oracle Database Administrator, Rackspace Technology","seo_description":"Gain insights into restoring an Oracle database using RMAN duplicate in Oracle 12c, critical for database refreshing and cloning tasks.\r\n","field_featured_image":"","insights_image":"\/wp-content\/uploads\/2026\/blog_technical_images\/26512-insights_image-oracle-technical-blog-1-insights.jpg","field_partners":"","rxt_platforms":"Oracle","product":"","publisheddate":"2020-12-23T12:09:43","rxt_solutions":"Application Management & Operations, Application Modernization","opengraph_tag":"","x_tag":"","teaser_flag":"Technical Blog","seo_titile":"Restore with RMAN Duplicate in Oracle 12c | Rackspace","field_topics":"","field_slug":"restore-oracle-database-by-using-rman-duplicate-in-oracle-12c","footnotes":""},"categories":[178],"tags":[204],"class_list":["post-7835","blogs","type-blogs","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-technical"],"_links":{"self":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/7835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs"}],"about":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/types\/blogs"}],"author":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/comments?post=7835"}],"version-history":[{"count":2,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/7835\/revisions"}],"predecessor-version":[{"id":17135,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/7835\/revisions\/17135"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/media\/7837"}],"wp:attachment":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/media?parent=7835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/categories?post=7835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/tags?post=7835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}