WHEN BOTH DIRECTORY AND DB NAME ARE SAME.
PRE - STEPS
I. DATABASE IN ARCHIVE LOG MODE.
II.CONTROL FILE AUTO BACKUP ON.
STEPS TO BE PERFORMED ON TARGET ( SOURCE ) DATABASE :
DB NAME : TARG
1. TAKE BACKUP OF DATABASE
RMAN > backup databaseplus archivelog;
2. ONCE BACKUP DONE COPY BACKUP-PIECES TO AUXILIARY (DESTINATION ) DATABASE USING LINUX
COMMAND scp.
RMAN > listbackup; (Shows listof back pieces )
RMAN > listbackup of controlfile;( shows control filebackup piece loction )
3. COPY PARAMETER FILE (init file) TO AUXILIARY ( DESTINATION ) DATABASE.
$ scp initTARG oracle@192.168.1.***:$ORACLE_HOME/dbs
4. ISSUE BELOW COMMANDS ON TARGET ( SOURCE ) DATABASE FOR FOR DATAFILES, REDOLOG FILES, CONTROL
FILES LOCATIONS.
SQL> select file_name from dba_data_files;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;
STEPS TO BE PERFORMED ON AUXILIARY (DESTINATION ) DATABASE.:
DB NAME : TARG
5. MAKE DIRECTORY STRUCTURE SAME AS TARGET ( SOURCE ) ON AUXILIARY ( DESTINATION ) SERVER FOR
DATAFILES, REDOLOG FILES, CONTROL FILES.
FOR DIRECTORY STRUCTURE REFER STEP 4.
6. START AUXILIARY ( DESTINATION ) DATABASE IN NOMOUNT MODE
$ export ORACLE_SID=TARG
$ sqlplus'/as sysdba'
[oracle@Dup dbs]$ sqlplus'/as sysdba'
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 19 11:27:10 2017
Copyright (c) 1982, 2011,Oracle. All rights reserved.
Connected to an idleinstance.
SQL> startup nomount
ORACLE instancestarted.
Total System Global Area 422670336 bytes
Fixed Size 1345380 bytes
VariableSize 264243356 bytes
DatabaseBuffers 150994944 bytes
Redo Buffers 6086656 bytes
SQL> exit
7. CONNECT TO AUXILIARY ( DESTINATION ) DATABASE.
$ rman auxiliary /
8. ISSUE DUPLICATE CONNAMD FROM RMAN PROMPT IN AUXILIARY ( DESTINATION ) DATABASE .
RMAN> duplicatedatabaseto TARG backup location '/u01/copied_backups' nofilenamecheck;
StartingDuplicateDb at 19-JAN-17
contents of Memory Script:
{
sql clone"create spfilefrommemory";
}
executing Memory Script
sql statement: create spfilefrom memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracleinstanceshutdown
connected to auxiliary database(notstarted)
Oracleinstancestarted
Total System Global Area 422670336 bytes
Fixed Size 1345380 bytes
VariableSize 268437660 bytes
DatabaseBuffers 146800640 bytes
Redo Buffers 6086656 bytes
contents of Memory Script:
{
sql clone"alter system set db_name =
''TARG'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone"alter system set db_unique_name =
''TARG'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfilefrom '/u01/copied_backups/o1_mf_s_933677269_d80lzzcs_.bkp';
alter clone databasemount;
}
executing Memory Script
sql statement: alter system set db_name = ''TARG'' comment= ''Modified by RMAN duplicate''
scope=spfile
sql statement: alter system set db_unique_name = ''TARG'' comment= ''Modified by RMAN duplicate''
scope=spfile
Oracleinstanceshutdown
Oracleinstancestarted
Total System Global Area 422670336 bytes
Fixed Size 1345380 bytes
VariableSize 268437660 bytes
DatabaseBuffers 146800640 bytes
Redo Buffers 6086656 bytes
Startingrestore at 19-JAN-17
allocated channel:ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK
channel ORA_AUX_DISK_1: restoringcontrol file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/u01/app/oracle/oradata/TARG/control01.ctl
output filename=/u01/app/oracle/fast_recovery_area/TARG/control02.ctl
Finished restoreat 19-JAN-17
databasemounted
released channel: ORA_AUX_DISK_1
allocated channel:ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK
contents of Memory Script:
{
set until scn 834228;
set newname for datafile 1 to
"/u01/app/oracle/oradata/TARG/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/TARG/sysaux01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/TARG/undotbs01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/TARG/users01.dbf";
restore
clonedatabase
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Startingrestore at 19-JAN-17
usingchannel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: startingdatafilebackup setrestore
channel ORA_AUX_DISK_1: specifyingdatafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoringdatafile00001 to /u01/app/oracle/oradata/TARG/system01.dbf
channel ORA_AUX_DISK_1: restoringdatafile00002 to /u01/app/oracle/oradata/TARG/sysaux01.dbf
channel ORA_AUX_DISK_1: restoringdatafile00003 to /u01/app/oracle/oradata/TARG/undotbs01.dbf
channel ORA_AUX_DISK_1: restoringdatafile00004 to /u01/app/oracle/oradata/TARG/users01.dbf
channel ORA_AUX_DISK_1: readingfrom backup piece
/u01/copied_backups/o1_mf_nnndf_TAG20170119T104443_d80lt42d_.bkp
channel ORA_AUX_DISK_1: piece
handle=/u01/copied_backups/o1_mf_nnndf_TAG20170119T104443_d80lt42d_.bkp tag=TAG20170119T104443
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:15
Finished restoreat 19-JAN-17
contents of Memory Script:
{
switch clonedatafileall;
}
executing Memory Script
datafile1 switched to datafilecopy
input datafilecopy RECID=1 STAMP=933680265 filename=/u01/app/oracle/oradata/TARG/system01.dbf
datafile2 switched to datafilecopy
input datafilecopy RECID=2 STAMP=933680265 filename=/u01/app/oracle/oradata/TARG/sysaux01.dbf
datafile3 switched to datafilecopy
input datafilecopy RECID=3 STAMP=933680265 file
name=/u01/app/oracle/oradata/TARG/undotbs01.dbf
datafile4 switched to datafilecopy
input datafilecopy RECID=4 STAMP=933680265 filename=/u01/app/oracle/oradata/TARG/users01.dbf
contents of Memory Script:
{
set until scn 834228;
recover
clonedatabase
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Startingrecover at 19-JAN-17
usingchannel ORA_AUX_DISK_1
startingmedia recovery
channel ORA_AUX_DISK_1: startingarchived logrestoreto default destination
channel ORA_AUX_DISK_1: restoringarchived log
archived logthread=1 sequence=9
channel ORA_AUX_DISK_1: readingfrom backup piece
/u01/copied_backups/o1_mf_annnn_TAG20170119T104747_d80lzvrk_.bkp
channel ORA_AUX_DISK_1: piece
handle=/u01/copied_backups/o1_mf_annnn_TAG20170119T104747_d80lzvrk_.bkp tag=TAG20170119T104747
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived logfile
name=/u01/app/oracle/fast_recovery_area/TARG/archivelog/2017_01_19/o1_mf_1_9_d80oxx8o_.arc thread=1
sequence=9
channel clone_default: deleting archived log(s)
archived logfile
name=/u01/app/oracle/fast_recovery_area/TARG/archivelog/2017_01_19/o1_mf_1_9_d80oxx8o_.arc RECID=1
STAMP=933680277
media recovery complete, elapsed time: 00:00:02
Finished recover at 19-JAN-17
Oracleinstancestarted
Total System Global Area 422670336 bytes
Fixed Size 1345380 bytes
VariableSize 268437660 bytes
DatabaseBuffers 146800640 bytes
Redo Buffers 6086656 bytes
contents of Memory Script:
{
sql clone"alter system set db_name =
''TARG'' comment=
''Reset to original valueby RMAN'' scope=spfile";
sql clone"alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''TARG'' comment= ''Reset to original valueby RMAN''
scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracleinstanceshutdown
connected to auxiliary database(notstarted)
Oracleinstancestarted
Total System Global Area 422670336 bytes
Fixed Size 1345380 bytes
VariableSize 268437660 bytes
DatabaseBuffers 146800640 bytes
Redo Buffers 6086656 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TARG" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 50 M ,
GROUP 2 SIZE 50 M ,
GROUP 3 SIZE 50 M
DATAFILE
'/u01/app/oracle/oradata/TARG/system01.dbf'
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/TARG/temp01.dbf";
switch clonetempfile all;
catalogclonedatafilecopy "/u01/app/oracle/oradata/TARG/sysaux01.dbf",
"/u01/app/oracle/oradata/TARG/undotbs01.dbf",
"/u01/app/oracle/oradata/TARG/users01.dbf";
switch clonedatafileall;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/TARG/temp01.dbf in control file
cataloged datafilecopy
datafilecopy filename=/u01/app/oracle/oradata/TARG/sysaux01.dbf RECID=1 STAMP=933680360
cataloged datafilecopy
datafilecopy filename=/u01/app/oracle/oradata/TARG/undotbs01.dbf RECID=2 STAMP=933680360
cataloged datafilecopy
datafilecopy filename=/u01/app/oracle/oradata/TARG/users01.dbf RECID=3 STAMP=933680361
datafile2 switched to datafilecopy
input datafilecopy RECID=1 STAMP=933680360 filename=/u01/app/oracle/oradata/TARG/sysaux01.dbf
datafile3 switched to datafilecopy
input datafilecopy RECID=2 STAMP=933680360 file
name=/u01/app/oracle/oradata/TARG/undotbs01.dbf
datafile4 switched to datafilecopy
input datafilecopy RECID=3 STAMP=933680361 filename=/u01/app/oracle/oradata/TARG/users01.dbf
contents of Memory Script:
{
Alter clonedatabaseopen resetlogs;
}
executing Memory Script
databaseopened
Finished DuplicateDb at 19-JAN-17
RMAN>
9. CHECK DATAFILE, CONTROL FILE AND REDOLOG FILE LOCATIONS BY CONNECT TO AUXILIARY ( DESTINATION )
DATABASE FROM SQL PROMPT.
SQL> select file_name from dba_data_files;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;

Rman cloning when both directory and db name are same.

  • 1.
    WHEN BOTH DIRECTORYAND DB NAME ARE SAME. PRE - STEPS I. DATABASE IN ARCHIVE LOG MODE. II.CONTROL FILE AUTO BACKUP ON. STEPS TO BE PERFORMED ON TARGET ( SOURCE ) DATABASE : DB NAME : TARG 1. TAKE BACKUP OF DATABASE RMAN > backup databaseplus archivelog; 2. ONCE BACKUP DONE COPY BACKUP-PIECES TO AUXILIARY (DESTINATION ) DATABASE USING LINUX COMMAND scp. RMAN > listbackup; (Shows listof back pieces ) RMAN > listbackup of controlfile;( shows control filebackup piece loction ) 3. COPY PARAMETER FILE (init file) TO AUXILIARY ( DESTINATION ) DATABASE. $ scp initTARG oracle@192.168.1.***:$ORACLE_HOME/dbs 4. ISSUE BELOW COMMANDS ON TARGET ( SOURCE ) DATABASE FOR FOR DATAFILES, REDOLOG FILES, CONTROL FILES LOCATIONS. SQL> select file_name from dba_data_files;
  • 2.
    SQL> select namefrom v$controlfile; SQL> select member from v$logfile; STEPS TO BE PERFORMED ON AUXILIARY (DESTINATION ) DATABASE.: DB NAME : TARG 5. MAKE DIRECTORY STRUCTURE SAME AS TARGET ( SOURCE ) ON AUXILIARY ( DESTINATION ) SERVER FOR DATAFILES, REDOLOG FILES, CONTROL FILES. FOR DIRECTORY STRUCTURE REFER STEP 4. 6. START AUXILIARY ( DESTINATION ) DATABASE IN NOMOUNT MODE $ export ORACLE_SID=TARG $ sqlplus'/as sysdba' [oracle@Dup dbs]$ sqlplus'/as sysdba' SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 19 11:27:10 2017 Copyright (c) 1982, 2011,Oracle. All rights reserved. Connected to an idleinstance. SQL> startup nomount ORACLE instancestarted.
  • 3.
    Total System GlobalArea 422670336 bytes Fixed Size 1345380 bytes VariableSize 264243356 bytes DatabaseBuffers 150994944 bytes Redo Buffers 6086656 bytes SQL> exit 7. CONNECT TO AUXILIARY ( DESTINATION ) DATABASE. $ rman auxiliary / 8. ISSUE DUPLICATE CONNAMD FROM RMAN PROMPT IN AUXILIARY ( DESTINATION ) DATABASE . RMAN> duplicatedatabaseto TARG backup location '/u01/copied_backups' nofilenamecheck; StartingDuplicateDb at 19-JAN-17 contents of Memory Script: { sql clone"create spfilefrommemory"; } executing Memory Script sql statement: create spfilefrom memory contents of Memory Script: { shutdown clone immediate; startup clone nomount; } executing Memory Script
  • 4.
    Oracleinstanceshutdown connected to auxiliarydatabase(notstarted) Oracleinstancestarted Total System Global Area 422670336 bytes Fixed Size 1345380 bytes VariableSize 268437660 bytes DatabaseBuffers 146800640 bytes Redo Buffers 6086656 bytes contents of Memory Script: { sql clone"alter system set db_name = ''TARG'' comment= ''Modified by RMAN duplicate'' scope=spfile"; sql clone"alter system set db_unique_name = ''TARG'' comment= ''Modified by RMAN duplicate'' scope=spfile"; shutdown clone immediate; startup clone force nomount restore clone primary controlfilefrom '/u01/copied_backups/o1_mf_s_933677269_d80lzzcs_.bkp'; alter clone databasemount; } executing Memory Script sql statement: alter system set db_name = ''TARG'' comment= ''Modified by RMAN duplicate'' scope=spfile sql statement: alter system set db_unique_name = ''TARG'' comment= ''Modified by RMAN duplicate'' scope=spfile Oracleinstanceshutdown
  • 5.
    Oracleinstancestarted Total System GlobalArea 422670336 bytes Fixed Size 1345380 bytes VariableSize 268437660 bytes DatabaseBuffers 146800640 bytes Redo Buffers 6086656 bytes Startingrestore at 19-JAN-17 allocated channel:ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=18 device type=DISK channel ORA_AUX_DISK_1: restoringcontrol file channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03 output filename=/u01/app/oracle/oradata/TARG/control01.ctl output filename=/u01/app/oracle/fast_recovery_area/TARG/control02.ctl Finished restoreat 19-JAN-17 databasemounted released channel: ORA_AUX_DISK_1 allocated channel:ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=18 device type=DISK contents of Memory Script: { set until scn 834228; set newname for datafile 1 to "/u01/app/oracle/oradata/TARG/system01.dbf"; set newname for datafile 2 to "/u01/app/oracle/oradata/TARG/sysaux01.dbf"; set newname for datafile 3 to "/u01/app/oracle/oradata/TARG/undotbs01.dbf"; set newname for datafile 4 to
  • 6.
    "/u01/app/oracle/oradata/TARG/users01.dbf"; restore clonedatabase ; } executing Memory Script executingcommand: SET until clause executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Startingrestore at 19-JAN-17 usingchannel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: startingdatafilebackup setrestore channel ORA_AUX_DISK_1: specifyingdatafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoringdatafile00001 to /u01/app/oracle/oradata/TARG/system01.dbf channel ORA_AUX_DISK_1: restoringdatafile00002 to /u01/app/oracle/oradata/TARG/sysaux01.dbf channel ORA_AUX_DISK_1: restoringdatafile00003 to /u01/app/oracle/oradata/TARG/undotbs01.dbf channel ORA_AUX_DISK_1: restoringdatafile00004 to /u01/app/oracle/oradata/TARG/users01.dbf channel ORA_AUX_DISK_1: readingfrom backup piece /u01/copied_backups/o1_mf_nnndf_TAG20170119T104443_d80lt42d_.bkp channel ORA_AUX_DISK_1: piece handle=/u01/copied_backups/o1_mf_nnndf_TAG20170119T104443_d80lt42d_.bkp tag=TAG20170119T104443 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:15 Finished restoreat 19-JAN-17 contents of Memory Script:
  • 7.
    { switch clonedatafileall; } executing MemoryScript datafile1 switched to datafilecopy input datafilecopy RECID=1 STAMP=933680265 filename=/u01/app/oracle/oradata/TARG/system01.dbf datafile2 switched to datafilecopy input datafilecopy RECID=2 STAMP=933680265 filename=/u01/app/oracle/oradata/TARG/sysaux01.dbf datafile3 switched to datafilecopy input datafilecopy RECID=3 STAMP=933680265 file name=/u01/app/oracle/oradata/TARG/undotbs01.dbf datafile4 switched to datafilecopy input datafilecopy RECID=4 STAMP=933680265 filename=/u01/app/oracle/oradata/TARG/users01.dbf contents of Memory Script: { set until scn 834228; recover clonedatabase delete archivelog ; } executing Memory Script executing command: SET until clause Startingrecover at 19-JAN-17 usingchannel ORA_AUX_DISK_1 startingmedia recovery channel ORA_AUX_DISK_1: startingarchived logrestoreto default destination channel ORA_AUX_DISK_1: restoringarchived log archived logthread=1 sequence=9
  • 8.
    channel ORA_AUX_DISK_1: readingfrombackup piece /u01/copied_backups/o1_mf_annnn_TAG20170119T104747_d80lzvrk_.bkp channel ORA_AUX_DISK_1: piece handle=/u01/copied_backups/o1_mf_annnn_TAG20170119T104747_d80lzvrk_.bkp tag=TAG20170119T104747 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 archived logfile name=/u01/app/oracle/fast_recovery_area/TARG/archivelog/2017_01_19/o1_mf_1_9_d80oxx8o_.arc thread=1 sequence=9 channel clone_default: deleting archived log(s) archived logfile name=/u01/app/oracle/fast_recovery_area/TARG/archivelog/2017_01_19/o1_mf_1_9_d80oxx8o_.arc RECID=1 STAMP=933680277 media recovery complete, elapsed time: 00:00:02 Finished recover at 19-JAN-17 Oracleinstancestarted Total System Global Area 422670336 bytes Fixed Size 1345380 bytes VariableSize 268437660 bytes DatabaseBuffers 146800640 bytes Redo Buffers 6086656 bytes contents of Memory Script: { sql clone"alter system set db_name = ''TARG'' comment= ''Reset to original valueby RMAN'' scope=spfile"; sql clone"alter system reset db_unique_name scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script
  • 9.
    sql statement: altersystem set db_name = ''TARG'' comment= ''Reset to original valueby RMAN'' scope=spfile sql statement: alter system reset db_unique_name scope=spfile Oracleinstanceshutdown connected to auxiliary database(notstarted) Oracleinstancestarted Total System Global Area 422670336 bytes Fixed Size 1345380 bytes VariableSize 268437660 bytes DatabaseBuffers 146800640 bytes Redo Buffers 6086656 bytes sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TARG" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 SIZE 50 M , GROUP 2 SIZE 50 M , GROUP 3 SIZE 50 M DATAFILE '/u01/app/oracle/oradata/TARG/system01.dbf' CHARACTER SET WE8MSWIN1252 contents of Memory Script: { set newname for tempfile 1 to "/u01/app/oracle/oradata/TARG/temp01.dbf";
  • 10.
    switch clonetempfile all; catalogclonedatafilecopy"/u01/app/oracle/oradata/TARG/sysaux01.dbf", "/u01/app/oracle/oradata/TARG/undotbs01.dbf", "/u01/app/oracle/oradata/TARG/users01.dbf"; switch clonedatafileall; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /u01/app/oracle/oradata/TARG/temp01.dbf in control file cataloged datafilecopy datafilecopy filename=/u01/app/oracle/oradata/TARG/sysaux01.dbf RECID=1 STAMP=933680360 cataloged datafilecopy datafilecopy filename=/u01/app/oracle/oradata/TARG/undotbs01.dbf RECID=2 STAMP=933680360 cataloged datafilecopy datafilecopy filename=/u01/app/oracle/oradata/TARG/users01.dbf RECID=3 STAMP=933680361 datafile2 switched to datafilecopy input datafilecopy RECID=1 STAMP=933680360 filename=/u01/app/oracle/oradata/TARG/sysaux01.dbf datafile3 switched to datafilecopy input datafilecopy RECID=2 STAMP=933680360 file name=/u01/app/oracle/oradata/TARG/undotbs01.dbf datafile4 switched to datafilecopy input datafilecopy RECID=3 STAMP=933680361 filename=/u01/app/oracle/oradata/TARG/users01.dbf contents of Memory Script: { Alter clonedatabaseopen resetlogs; } executing Memory Script databaseopened Finished DuplicateDb at 19-JAN-17
  • 11.
    RMAN> 9. CHECK DATAFILE,CONTROL FILE AND REDOLOG FILE LOCATIONS BY CONNECT TO AUXILIARY ( DESTINATION ) DATABASE FROM SQL PROMPT. SQL> select file_name from dba_data_files; SQL> select name from v$controlfile; SQL> select member from v$logfile;