We can perform RMAN DUPLICATE operation without connecting to the target database, but this will work ONLY for disk backups.
This is achieved via BACKUP LOCATION clause of DUPLICATE command i.e.
DUPLICATE DATABASE TO DBNAME
UNTIL TIME "TO_DATE('11/01/2007 14:00:00', 'MM/DD/YYYY HH24:MI:SS')"
BACKUP LOCATION '/<backup location>/'
NOFILENAMECHECK;
Here is an example ,
orcl12c is my source which is a container database and I'm going to duplicate a container database "trorcl" from it .
First take full database backup of orcl12c.
RUN
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
sql "alter system archive log current";
BACKUP AS COMPRESSED BACKUPSET FULL TAG 'ORCL12C_FULL' DATABASE format '/backup/Backup_%d_%T_%s' include current controlfile;
sql "alter system archive log current";
backup archivelog all format '/backup/Archive_%d_%T_%s';
}
[oracle@orcldb02 backup]$ . oraenv
ORACLE_SID = [orcl12c] ?
ORACLE_BASE environment variable is not being set since this
information is not available for the current user ID oracle.
You can set ORACLE_BASE manually if it is required.
Resetting ORACLE_BASE to its previous value or ORACLE_HOME
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@orcldb02 backup]$
[oracle@orcldb02 backup]$ rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Tue Jan 5 09:06:15 2021
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL12C (DBID=768045447)
RMAN> RUN
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
sql "alter system archive log current";
BACKUP AS COMPRESSED BACKUPSET FULL TAG 'ORCL12C_FULL' DATABASE format '/backup/Backup_%d_%T_%s' include current controlfile;
sql "alter system archive log current";
backup archivelog all format '/backup/Archive_%d_%T_%s';
}
2> 3> 4> 5> 6> 7> 8> 9> 10> 11>
using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=69 device type=DISK
allocated channel: d2
channel d2: SID=67 device type=DISK
allocated channel: d3
channel d3: SID=70 device type=DISK
allocated channel: d4
channel d4: SID=68 device type=DISK
sql statement: alter system archive log current
Starting backup at 05-JAN-21
channel d1: starting compressed full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00010 name=/u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf
input datafile file number=00014 name=/u01/app/oracle/oradata/orcl12c/orcl/APEX_1993195660370985.dbf
channel d1: starting piece 1 at 05-JAN-21
channel d2: starting compressed full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl12c/system01.dbf
channel d2: starting piece 1 at 05-JAN-21
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl12c/sysaux01.dbf
channel d3: starting piece 1 at 05-JAN-21
channel d4: starting compressed full datafile backup set
channel d4: specifying datafile(s) in backup set
input datafile file number=00011 name=/u01/app/oracle/oradata/orcl12c/orcl/undotbs01.dbf
input datafile file number=00013 name=/u01/app/oracle/oradata/orcl12c/orcl/APEX_1991375173370654.dbf
channel d4: starting piece 1 at 05-JAN-21
channel d4: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_27 tag=ORCL12C_FULL comment=NONE
channel d4: backup set complete, elapsed time: 00:04:25
channel d4: starting compressed full datafile backup set
channel d4: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/app/oracle/oradata/orcl12c/orcl/system01.dbf
input datafile file number=00012 name=/u01/app/oracle/oradata/orcl12c/orcl/users01.dbf
channel d4: starting piece 1 at 05-JAN-21
channel d2: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_25 tag=ORCL12C_FULL comment=NONE
channel d2: backup set complete, elapsed time: 00:05:00
channel d2: starting compressed full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00006 name=/u01/app/oracle/oradata/orcl12c/pdbseed/sysaux01.dbf
channel d2: starting piece 1 at 05-JAN-21
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_26 tag=ORCL12C_FULL comment=NONE
channel d3: backup set complete, elapsed time: 00:05:06
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf
channel d3: starting piece 1 at 05-JAN-21
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_30 tag=ORCL12C_FULL comment=NONE
channel d3: backup set complete, elapsed time: 00:02:48
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00008 name=/u01/app/oracle/oradata/orcl12c/pdbseed/undotbs01.dbf
channel d3: starting piece 1 at 05-JAN-21
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_31 tag=ORCL12C_FULL comment=NONE
channel d3: backup set complete, elapsed time: 00:00:26
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00015 name=/u01/app/oracle/oradata/orcl12c/undotbs2.dbf
channel d3: starting piece 1 at 05-JAN-21
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_32 tag=ORCL12C_FULL comment=NONE
channel d3: backup set complete, elapsed time: 00:00:09
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set
including current control file in backup set
channel d3: starting piece 1 at 05-JAN-21
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_33 tag=ORCL12C_FULL comment=NONE
channel d3: backup set complete, elapsed time: 00:00:03
channel d3: starting compressed full datafile backup set
channel d3: specifying datafile(s) in backup set
input datafile file number=00007 name=/u01/app/oracle/oradata/orcl12c/users01.dbf
channel d3: starting piece 1 at 05-JAN-21
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_34 tag=ORCL12C_FULL comment=NONE
channel d3: backup set complete, elapsed time: 00:00:01
channel d4: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_28 tag=ORCL12C_FULL comment=NONE
channel d4: backup set complete, elapsed time: 00:04:08
channel d2: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_29 tag=ORCL12C_FULL comment=NONE
channel d2: backup set complete, elapsed time: 00:04:41
channel d1: finished piece 1 at 05-JAN-21
piece handle=/backup/Backup_ORCL12C_20210105_24 tag=ORCL12C_FULL comment=NONE
channel d1: backup set complete, elapsed time: 00:11:28
Finished backup at 05-JAN-21
Starting Control File and SPFILE Autobackup at 05-JAN-21
piece handle=/u01/app/oracle/fast_recovery_area/orcl12c/ORCL12C/autobackup/2021_01_05/o1_mf_s_1061025496_hz8x9bow_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 05-JAN-21
sql statement: alter system archive log current
Starting backup at 05-JAN-21
current log archived
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=1 STAMP=1061014251
channel d1: starting piece 1 at 05-JAN-21
channel d2: starting archived log backup set
channel d2: specifying archived log(s) in backup set
input archived log thread=1 sequence=25 RECID=5 STAMP=1061022907
input archived log thread=1 sequence=26 RECID=6 STAMP=1061023293
input archived log thread=1 sequence=27 RECID=7 STAMP=1061023587
channel d2: starting piece 1 at 05-JAN-21
channel d3: starting archived log backup set
channel d3: specifying archived log(s) in backup set
input archived log thread=1 sequence=28 RECID=8 STAMP=1061024604
input archived log thread=1 sequence=29 RECID=9 STAMP=1061024803
input archived log thread=1 sequence=30 RECID=10 STAMP=1061025509
channel d3: starting piece 1 at 05-JAN-21
channel d4: starting archived log backup set
channel d4: specifying archived log(s) in backup set
input archived log thread=1 sequence=22 RECID=2 STAMP=1061014300
input archived log thread=1 sequence=23 RECID=3 STAMP=1061014409
input archived log thread=1 sequence=24 RECID=4 STAMP=1061014805
channel d4: starting piece 1 at 05-JAN-21
channel d1: finished piece 1 at 05-JAN-21
piece handle=/backup/Archive_ORCL12C_20210105_36 tag=TAG20210105T091830 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=31 RECID=11 STAMP=1061025510
channel d1: starting piece 1 at 05-JAN-21
channel d2: finished piece 1 at 05-JAN-21
piece handle=/backup/Archive_ORCL12C_20210105_37 tag=TAG20210105T091830 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:01
channel d3: finished piece 1 at 05-JAN-21
piece handle=/backup/Archive_ORCL12C_20210105_38 tag=TAG20210105T091830 comment=NONE
channel d3: backup set complete, elapsed time: 00:00:01
channel d4: finished piece 1 at 05-JAN-21
piece handle=/backup/Archive_ORCL12C_20210105_39 tag=TAG20210105T091830 comment=NONE
channel d4: backup set complete, elapsed time: 00:00:00
channel d1: finished piece 1 at 05-JAN-21
piece handle=/backup/Archive_ORCL12C_20210105_40 tag=TAG20210105T091830 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:00
Finished backup at 05-JAN-21
Starting Control File and SPFILE Autobackup at 05-JAN-21
piece handle=/u01/app/oracle/fast_recovery_area/orcl12c/ORCL12C/autobackup/2021_01_05/o1_mf_s_1061025514_hz8x9two_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 05-JAN-21
released channel: d1
released channel: d2
released channel: d3
released channel: d4
RMAN>
[oracle@orcldb02 backup]$ ls -lhrt
total 994M
-rw-r----- 1 oracle oinstall 1.8M Jan 5 09:07 Backup_ORCL12C_20210105_27
-rw-r----- 1 oracle oinstall 110M Jan 5 09:09 Backup_ORCL12C_20210105_26
-rw-r----- 1 oracle oinstall 205M Jan 5 09:11 Backup_ORCL12C_20210105_25
-rw-r----- 1 oracle oinstall 52M Jan 5 09:14 Backup_ORCL12C_20210105_30
-rw-r----- 1 oracle oinstall 7.8M Jan 5 09:15 Backup_ORCL12C_20210105_31
-rw-r----- 1 oracle oinstall 1.4M Jan 5 09:15 Backup_ORCL12C_20210105_32
-rw-r----- 1 oracle oinstall 1.1M Jan 5 09:15 Backup_ORCL12C_20210105_33
-rw-r----- 1 oracle oinstall 1.1M Jan 5 09:15 Backup_ORCL12C_20210105_34
-rw-r----- 1 oracle oinstall 88M Jan 5 09:15 Backup_ORCL12C_20210105_28
-rw-r----- 1 oracle oinstall 105M Jan 5 09:16 Backup_ORCL12C_20210105_29
-rw-r----- 1 oracle oinstall 409M Jan 5 09:18 Backup_ORCL12C_20210105_24
-rw-r----- 1 oracle oinstall 7.3M Jan 5 09:18 Archive_ORCL12C_20210105_36
-rw-r----- 1 oracle oinstall 3.5M Jan 5 09:18 Archive_ORCL12C_20210105_37
-rw-r----- 1 oracle oinstall 3.1M Jan 5 09:18 Archive_ORCL12C_20210105_38
-rw-r----- 1 oracle oinstall 470K Jan 5 09:18 Archive_ORCL12C_20210105_39
-rw-r----- 1 oracle oinstall 3.5K Jan 5 09:18 Archive_ORCL12C_20210105_40
[oracle@orcldb02 backup]$
Create a pfile for target database.
[oracle@orcldb02 backup]$
[oracle@orcldb02 backup]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 5 06:48:42 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
SQL> create pfile='/tmp/inittrorcl.ora' from spfile ;
File created.
SQL>
Lets edit it,
[oracle@orcldb02 ~]$ cat /tmp/inittrorcl.ora
trorcl.__data_transfer_cache_size=0
trorcl.__db_cache_size=536870912
trorcl.__inmemory_ext_roarea=0
trorcl.__inmemory_ext_rwarea=0
trorcl.__java_pool_size=4194304
trorcl.__large_pool_size=8388608
trorcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
trorcl.__pga_aggregate_target=209715200
trorcl.__sga_target=838860800
trorcl.__shared_io_pool_size=0
trorcl.__shared_pool_size=276824064
trorcl.__streams_pool_size=0
*._ash_size=25165824
*.audit_file_dest='/u01/app/oracle/admin/trorcl/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/u01/app/oracle/oradata/trorcl/control01.ctl','/u01/app/oracle/fast_recovery_area/trorcl/control02.ctl'
*.db_block_size=8192
*.db_name='trorcl'
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/trorcl'
*.db_recovery_file_dest_size=5g
*.diagnostic_dest='/u01/app/oracle'
*.enable_pluggable_database=true
*.local_listener='LISTENER_ORCL12C'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=200m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=800m
*.shared_servers=25
*.undo_tablespace='UNDOTBS2'
[oracle@orcldb02 ~]$
Create necessary directories,
[oracle@orcldb02 backup]$
[oracle@orcldb02 backup]$ mkdir -p /u01/app/oracle/admin/trorcl/adump
[oracle@orcldb02 backup]$ mkdir -p /u01/app/oracle/oradata/trorcl
[oracle@orcldb02 backup]$
[oracle@orcldb02 backup]$ mkdir -p /u01/app/oracle/fast_recovery_area/trorcl
[oracle@orcldb02 backup]$
Create a source file for new database and set it.
[oracle@orcldb02 ~]$ cat settrorcl
export ORACLE_SID=trorcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/12.2/db_1
export PATH=$ORACLE_HOME/bin:$PATH
[oracle@orcldb02 ~]$
[oracle@orcldb02 ~]$ . settrorcl
[oracle@orcldb02 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 5 07:04:16 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='/tmp/inittrorcl.ora';
ORACLE instance started.
Total System Global Area 838860800 bytes
Fixed Size 8798312 bytes
Variable Size 339742616 bytes
Database Buffers 486539264 bytes
Redo Buffers 3780608 bytes
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@orcldb02 ~]$
Now duplicate the database using below syntax,
Run
{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux4 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux5 DEVICE TYPE DISK;
DUPLICATE DATABASE TO TRORCL BACKUP LOCATION '/backup/' NOFILENAMECHECK;
}
[oracle@orcldb02 ~]$ rman auxiliary /
Recovery Manager: Release 12.2.0.1.0 - Production on Tue Jan 5 09:26:46 2021
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to auxiliary database: TRORCL (not mounted)
RMAN>
Run
{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux4 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux5 DEVICE TYPE DISK;
DUPLICATE DATABASE TO TRORCL BACKUP LOCATION '/backup/' NOFILENAMECHECK;
}
RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
allocated channel: aux1
channel aux1: SID=35 device type=DISK
allocated channel: aux2
channel aux2: SID=36 device type=DISK
allocated channel: aux3
channel aux3: SID=37 device type=DISK
allocated channel: aux4
channel aux4: SID=38 device type=DISK
allocated channel: aux5
channel aux5: SID=39 device type=DISK
Starting Duplicate Db at 05-JAN-21
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 838860800 bytes
Fixed Size 8798312 bytes
Variable Size 339742616 bytes
Database Buffers 486539264 bytes
Redo Buffers 3780608 bytes
allocated channel: aux1
channel aux1: SID=35 device type=DISK
allocated channel: aux2
channel aux2: SID=36 device type=DISK
allocated channel: aux3
channel aux3: SID=37 device type=DISK
allocated channel: aux4
channel aux4: SID=38 device type=DISK
allocated channel: aux5
channel aux5: SID=39 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORCL12C'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''trorcl'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile from '/backup/Backup_ORCL12C_20210105_33';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''ORCL12C'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''trorcl'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 838860800 bytes
Fixed Size 8798312 bytes
Variable Size 339742616 bytes
Database Buffers 486539264 bytes
Redo Buffers 3780608 bytes
allocated channel: aux1
channel aux1: SID=35 device type=DISK
allocated channel: aux2
channel aux2: SID=36 device type=DISK
allocated channel: aux3
channel aux3: SID=37 device type=DISK
allocated channel: aux4
channel aux4: SID=38 device type=DISK
allocated channel: aux5
channel aux5: SID=39 device type=DISK
Starting restore at 05-JAN-21
channel aux2: skipped, AUTOBACKUP already found
channel aux3: skipped, AUTOBACKUP already found
channel aux4: skipped, AUTOBACKUP already found
channel aux5: skipped, AUTOBACKUP already found
channel aux1: restoring control file
channel aux1: restore complete, elapsed time: 00:00:14
output file name=/u01/app/oracle/oradata/trorcl/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/trorcl/control02.ctl
Finished restore at 05-JAN-21
database mounted
contents of Memory Script:
{
set until scn 2945638;
set newname for clone datafile 1 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 5 to new;
set newname for clone datafile 6 to new;
set newname for clone datafile 7 to new;
set newname for clone datafile 8 to new;
set newname for clone datafile 9 to new;
set newname for clone datafile 10 to new;
set newname for clone datafile 11 to new;
set newname for clone datafile 12 to new;
set newname for clone datafile 13 to new;
set newname for clone datafile 14 to new;
set newname for clone datafile 15 to new;
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 05-JAN-21
channel aux1: starting datafile backup set restore
channel aux1: specifying datafile(s) to restore from backup set
channel aux1: restoring datafile 00010 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_%u_.dbf
channel aux1: restoring datafile 00014 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_%u_.dbf
channel aux1: reading from backup piece /backup/Backup_ORCL12C_20210105_24
channel aux2: starting datafile backup set restore
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00003 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_%u_.dbf
channel aux2: reading from backup piece /backup/Backup_ORCL12C_20210105_26
channel aux3: starting datafile backup set restore
channel aux3: specifying datafile(s) to restore from backup set
channel aux3: restoring datafile 00011 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_%u_.dbf
channel aux3: restoring datafile 00013 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_%u_.dbf
channel aux3: reading from backup piece /backup/Backup_ORCL12C_20210105_27
channel aux4: starting datafile backup set restore
channel aux4: specifying datafile(s) to restore from backup set
channel aux4: restoring datafile 00001 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_system_%u_.dbf
channel aux4: reading from backup piece /backup/Backup_ORCL12C_20210105_25
channel aux5: starting datafile backup set restore
channel aux5: specifying datafile(s) to restore from backup set
channel aux5: restoring datafile 00009 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_%u_.dbf
channel aux5: restoring datafile 00012 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_%u_.dbf
channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_28
channel aux3: piece handle=/backup/Backup_ORCL12C_20210105_27 tag=ORCL12C_FULL
channel aux3: restored backup piece 1
channel aux3: restore complete, elapsed time: 00:03:15
channel aux3: starting datafile backup set restore
channel aux3: specifying datafile(s) to restore from backup set
channel aux3: restoring datafile 00005 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_system_%u_.dbf
channel aux3: reading from backup piece /backup/Backup_ORCL12C_20210105_30
channel aux2: piece handle=/backup/Backup_ORCL12C_20210105_26 tag=ORCL12C_FULL
channel aux2: restored backup piece 1
channel aux2: restore complete, elapsed time: 00:03:56
channel aux2: starting datafile backup set restore
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00006 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_%u_.dbf
channel aux2: reading from backup piece /backup/Backup_ORCL12C_20210105_29
channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_28 tag=ORCL12C_FULL
channel aux5: restored backup piece 1
channel aux5: restore complete, elapsed time: 00:04:11
channel aux5: starting datafile backup set restore
channel aux5: specifying datafile(s) to restore from backup set
channel aux5: restoring datafile 00007 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_%u_.dbf
channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_34
channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_34 tag=ORCL12C_FULL
channel aux5: restored backup piece 1
channel aux5: restore complete, elapsed time: 00:00:02
channel aux5: starting datafile backup set restore
channel aux5: specifying datafile(s) to restore from backup set
channel aux5: restoring datafile 00008 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_%u_.dbf
channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_31
channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_31 tag=ORCL12C_FULL
channel aux5: restored backup piece 1
channel aux5: restore complete, elapsed time: 00:00:26
channel aux5: starting datafile backup set restore
channel aux5: specifying datafile(s) to restore from backup set
channel aux5: restoring datafile 00015 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_%u_.dbf
channel aux5: reading from backup piece /backup/Backup_ORCL12C_20210105_32
channel aux5: piece handle=/backup/Backup_ORCL12C_20210105_32 tag=ORCL12C_FULL
channel aux5: restored backup piece 1
channel aux5: restore complete, elapsed time: 00:00:15
channel aux3: piece handle=/backup/Backup_ORCL12C_20210105_30 tag=ORCL12C_FULL
channel aux3: restored backup piece 1
channel aux3: restore complete, elapsed time: 00:01:47
channel aux4: piece handle=/backup/Backup_ORCL12C_20210105_25 tag=ORCL12C_FULL
channel aux4: restored backup piece 1
channel aux4: restore complete, elapsed time: 00:05:57
channel aux2: piece handle=/backup/Backup_ORCL12C_20210105_29 tag=ORCL12C_FULL
channel aux2: restored backup piece 1
channel aux2: restore complete, elapsed time: 00:02:11
channel aux1: piece handle=/backup/Backup_ORCL12C_20210105_24 tag=ORCL12C_FULL
channel aux1: restored backup piece 1
channel aux1: restore complete, elapsed time: 00:07:07
Finished restore at 05-JAN-21
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=14 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_system_hz8xwbs9_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=15 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=16 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_system_hz8y2x7y_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=17 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=18 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=19 STAMP=1061026534 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=20 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_hz8xwc2q_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=21 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=22 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=23 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=24 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=25 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf
datafile 15 switched to datafile copy
input datafile copy RECID=26 STAMP=1061026535 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf
contents of Memory Script:
{
set until scn 2945638;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 05-JAN-21
starting media recovery
channel aux1: starting archived log restore to default destination
channel aux1: restoring archived log
archived log thread=1 sequence=30
channel aux1: reading from backup piece /backup/Archive_ORCL12C_20210105_38
channel aux2: starting archived log restore to default destination
channel aux2: restoring archived log
archived log thread=1 sequence=31
channel aux2: reading from backup piece /backup/Archive_ORCL12C_20210105_40
channel aux1: piece handle=/backup/Archive_ORCL12C_20210105_38 tag=TAG20210105T091830
channel aux1: restored backup piece 1
channel aux1: restore complete, elapsed time: 00:00:02
archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_30_hz8y9w5v_.arc thread=1 sequence=30
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_30_hz8y9w5v_.arc RECID=1 STAMP=1061026540
channel aux2: piece handle=/backup/Archive_ORCL12C_20210105_40 tag=TAG20210105T091830
channel aux2: restored backup piece 1
channel aux2: restore complete, elapsed time: 00:00:03
archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_31_hz8y9w7o_.arc thread=1 sequence=31
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/trorcl/TRORCL/archivelog/2021_01_05/o1_mf_1_31_hz8y9w7o_.arc RECID=2 STAMP=1061026540
media recovery complete, elapsed time: 00:00:00
Finished recover at 05-JAN-21
released channel: aux1
released channel: aux2
released channel: aux3
released channel: aux4
released channel: aux5
Oracle instance started
Total System Global Area 838860800 bytes
Fixed Size 8798312 bytes
Variable Size 339742616 bytes
Database Buffers 486539264 bytes
Redo Buffers 3780608 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''TRORCL'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script
sql statement: alter system set db_name = ''TRORCL'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started
Total System Global Area 838860800 bytes
Fixed Size 8798312 bytes
Variable Size 339742616 bytes
Database Buffers 486539264 bytes
Redo Buffers 3780608 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TRORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 200 M ,
GROUP 2 SIZE 200 M ,
GROUP 3 SIZE 200 M
DATAFILE
'/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_system_hz8xwbs9_.dbf',
'/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_system_hz8y2x7y_.dbf',
'/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_system_hz8xwc2q_.dbf'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for clone tempfile 1 to new;
set newname for clone tempfile 2 to new;
set newname for clone tempfile 3 to new;
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf",
"/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf",
"/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf",
"/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/TRORCL/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 2 to /u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 3 to /u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_temp_%u_.tmp in control file
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf RECID=1 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf RECID=2 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf RECID=3 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf RECID=4 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf RECID=5 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf RECID=6 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf RECID=7 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf RECID=8 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf RECID=9 STAMP=1061026579
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf RECID=10 STAMP=1061026579
datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_sysaux_hz8xwbrc_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=2 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_sysaux_hz8y3s8x_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=3 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_users_hz8y472s_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=4 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFE9E2D73E2038E0530100007F846C/datafile/o1_mf_undotbs1_hz8y48wm_.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=5 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_sysaux_hz8xwc2h_.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=6 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_undotbs1_hz8xwc2j_.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=7 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_users_hz8xwcfh_.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=8 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcfs_.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=9 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/49BFF8A6BB912582E0530100007F8BE4/datafile/o1_mf_apex_199_hz8xwcd9_.dbf
datafile 15 switched to datafile copy
input datafile copy RECID=10 STAMP=1061026579 file name=/u01/app/oracle/oradata/TRORCL/datafile/o1_mf_undotbs2_hz8y52hq_.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
contents of Memory Script:
{
sql clone "alter pluggable database all open";
}
executing Memory Script
sql statement: alter pluggable database all open
Cannot remove created server parameter file
Finished Duplicate Db at 05-JAN-21
RMAN>
Lets verify it
[oracle@orcldb02 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 5 09:47:40 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select name ,open_mode from v$database ;
NAME OPEN_MODE
--------- --------------------
TRORCL READ WRITE
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCL READ WRITE NO
SQL>