************************************
---RMAN cloning/duplicate using Backup--
************************************
v
SERVER
01: PROD (source)
Ü
step 01:
[oracle@source ~]$ mkdir /u01/backup
[oracle@source ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sat
Aug 3 00:53:30 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Connected to target database: MAXCDB (DBID=2567024698)
RMAN> RUN {
ALLOCATE CHANNEL chl1 TYPE DISK MAXPIECESIZE 10G;
ALLOCATE CHANNEL chl2 TYPE DISK MAXPIECESIZE 10G;
ALLOCATE CHANNEL chl3 TYPE DISK MAXPIECESIZE 10G;
BACKUP
FORMAT '/u01/backup/%d_D_LEVEL0_%T_%u_s%s_p%p'
INCREMENTAL LEVEL 0 DATABASE
CURRENT CONTROLFILE
FORMAT '/u01/backup/%d_C_LEVEL0_%T_%u'
SPFILE
FORMAT '/u01/backup/%d_S_LEVEL0_%T_%u'
PLUS ARCHIVELOG
FORMAT '/u01/backup/%d_A_LEVEL0_%T_%u_s%s_p%p';
RELEASE CHANNEL chl1;
RELEASE CHANNEL chl2;
RELEASE CHANNEL chl3;
}
using target database control file instead of recovery
catalog
allocated channel: chl1
channel chl1: SID=35 device type=DISK
allocated channel: chl2
channel chl2: SID=284 device type=DISK
allocated channel: chl3
channel chl3: SID=36 device type=DISK
Starting backup at 03-AUG-24
released channel: chl1
released channel: chl2
released channel: chl3
Ü
step 02:
[root@source ~]# vi /etc/hosts
[root@source ~]# cat /etc/hosts
127.0.0.1
localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.73.134 source.db1.com source
192.168.73.135 target.db2.com target
v
SERVER
02: DEV (target)
Ü
step 03:
[root@target ~]# vi /etc/hosts
[root@target ~]# cat /etc/hosts
127.0.0.1
localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.73.135 target.db2.com target
192.168.73.134 source.db1.com source
Ü
step 04:
[oracle@target ~]$ mkdir /u01/backup
Ü
step 05:
[oracle@target ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=maxcdb
export PATH=$ORACLE_HOME/bin:$PATH
v
SERVER
01: PROD (source)
Ü
step 06:
[oracle@source ~]$ cd /u01/backup/
[oracle@source backup]$ ls
MAXCDB_A_LEVEL0_20240803_0131gf8p_s1_p1
MAXCDB_A_LEVEL0_20240803_0231gf8p_s2_p1
MAXCDB_A_LEVEL0_20240803_0331gf8p_s3_p1
MAXCDB_A_LEVEL0_20240803_0d31gf9a_s13_p1
MAXCDB_C_LEVEL0_20240803_0b31gf98
MAXCDB_D_LEVEL0_20240803_0431gf8s_s4_p1
MAXCDB_D_LEVEL0_20240803_0531gf8s_s5_p1
MAXCDB_D_LEVEL0_20240803_0631gf8s_s6_p1
MAXCDB_D_LEVEL0_20240803_0731gf93_s7_p1
MAXCDB_D_LEVEL0_20240803_0831gf97_s8_p1
MAXCDB_D_LEVEL0_20240803_0931gf97_s9_p1
MAXCDB_D_LEVEL0_20240803_0a31gf97_s10_p1
MAXCDB_S_LEVEL0_20240803_0c31gf98
[oracle@source backup]$ scp * oracle@target:/u01/backup/
The authenticity of host 'target (192.168.73.135)' can't
be established.
ECDSA key fingerprint is SHA256:zZ7IkyYbrgaYCI/gMmp1C68FqwMahKMcMniTfaG/BcY.
ECDSA key fingerprint is MD5:9f:eb:77:48:d9:f9:0a:f1:40:e7:d7:9d:1e:5c:69:8e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'target,192.168.73.135' (ECDSA) to the list of known hosts.
oracle@target's password:
MAXCDB_A_LEVEL0_20240803_0131gf8p_s1_p1 100% 190MB 119.2MB/s 00:01
MAXCDB_A_LEVEL0_20240803_0231gf8p_s2_p1 100% 98MB 118.6MB/s 00:00
MAXCDB_A_LEVEL0_20240803_0331gf8p_s3_p1 100% 1024KB 88.0MB/s 00:00
MAXCDB_A_LEVEL0_20240803_0d31gf9a_s13_p1 100% 112KB 35.7MB/s 00:00
MAXCDB_C_LEVEL0_20240803_0b31gf98 100% 18MB 95.8MB/s 00:00
MAXCDB_D_LEVEL0_20240803_0431gf8s_s4_p1 100% 785MB 86.0MB/s 00:09
MAXCDB_D_LEVEL0_20240803_0531gf8s_s5_p1 100% 723MB 90.3MB/s 00:08
MAXCDB_D_LEVEL0_20240803_0631gf8s_s6_p1 100% 350MB 71.2MB/s 00:04
MAXCDB_D_LEVEL0_20240803_0731gf93_s7_p1 100% 254MB 67.7MB/s 00:03
MAXCDB_D_LEVEL0_20240803_0831gf97_s8_p1 100% 220MB 89.7MB/s 00:02
MAXCDB_D_LEVEL0_20240803_0931gf97_s9_p1 100% 218MB 109.0MB/s 00:02
MAXCDB_D_LEVEL0_20240803_0a31gf97_s10_p1 100% 86MB 85.7MB/s 00:00
MAXCDB_S_LEVEL0_20240803_0c31gf98 100% 112KB 15.4MB/s 00:00
Ü
step 07:
[oracle@source ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 3
01:51:48 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> create pfile from spfile;
File created.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@source ~]$ cd $ORACLE_HOME/dbs
[oracle@source dbs]$ ls
hc_maxcdb.dat init.ora orapwmaxcdb spfilemaxcdb.ora
initmaxcdb.ora lkMAXCDB snapcf_maxcdb.f
Ü
step 08:
[oracle@source dbs]$ scp initmaxcdb.ora
oracle@target:$ORACLE_HOME/dbs
oracle@target's password:
initmaxcdb.ora 100% 1220 618.4KB/s 00:00
[oracle@source dbs]$
v
SERVER
02: DEV (target)
Ü
step 09:
[oracle@target backup]$ mkdir -p
/u01/app/oracle/admin/maxcdb/adump
[oracle@target backup]$ mkdir -p /u01/app/oracle/oradata/MAXCDB/
[oracle@target backup]$ mkdir -p /u01/app/oracle/fast_recovery_area/MAXCDB/
Ü
step 10:
[oracle@prod ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sat
Mar 16 10:32:35 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system
parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initorclcdb.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1073737800 bytes
Fixed Size 8904776 bytes
Variable Size 276824064 bytes
Database Buffers 784334848 bytes
Redo Buffers 3674112 bytes
RMAN> restore spfile from
'/u01/rman/ORCLCDB_S_LEVEL0_20240316_6b2lr2j6_s203_p1';
RMAN> shutdown immediate;
using target database control file instead of recovery
catalog
database closed
database dismounted
Oracle instance shut down
RMAN> startup nomount;
connected to target database (not started)
Oracle instance started
Total System Global Area 2365584784 bytes
Fixed Size 9180560 bytes
Variable Size 536870912 bytes
Database Buffers 1811939328 bytes
Redo Buffers 7593984 bytes
[oracle@test ~]$ rman auxiliary /
Recovery Manager: Release 19.0.0.0.0 - Production on Sat
Aug 3 06:50:41 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to auxiliary database: MAXCDB (not mounted)
RMAN> duplicate database to maxcdb backup location
'/u01/backup' nofilenamecheck;
Starting Duplicate Db at 03-AUG-24
searching for database ID
found backup of database ID 2567024698
sql statement: alter pluggable database all open
Finished Duplicate Db at 03-AUG-24
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Connected to target database: MAXCDB (DBID=2567024698)
ALLOCATE CHANNEL chl1 TYPE DISK MAXPIECESIZE 10G;
ALLOCATE CHANNEL chl2 TYPE DISK MAXPIECESIZE 10G;
ALLOCATE CHANNEL chl3 TYPE DISK MAXPIECESIZE 10G;
BACKUP
FORMAT '/u01/backup/%d_D_LEVEL0_%T_%u_s%s_p%p'
INCREMENTAL LEVEL 0 DATABASE
CURRENT CONTROLFILE
FORMAT '/u01/backup/%d_C_LEVEL0_%T_%u'
SPFILE
FORMAT '/u01/backup/%d_S_LEVEL0_%T_%u'
PLUS ARCHIVELOG
FORMAT '/u01/backup/%d_A_LEVEL0_%T_%u_s%s_p%p';
RELEASE CHANNEL chl1;
RELEASE CHANNEL chl2;
RELEASE CHANNEL chl3;
}
allocated channel: chl1
channel chl1: SID=35 device type=DISK
allocated channel: chl2
channel chl2: SID=284 device type=DISK
allocated channel: chl3
channel chl3: SID=36 device type=DISK
Starting backup at 03-AUG-24
released channel: chl1
released channel: chl2
released channel: chl3
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.73.134 source.db1.com source
192.168.73.135 target.db2.com target
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.73.135 target.db2.com target
192.168.73.134 source.db1.com source
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=maxcdb
export PATH=$ORACLE_HOME/bin:$PATH
MAXCDB_A_LEVEL0_20240803_0131gf8p_s1_p1
MAXCDB_A_LEVEL0_20240803_0231gf8p_s2_p1
MAXCDB_A_LEVEL0_20240803_0331gf8p_s3_p1
MAXCDB_A_LEVEL0_20240803_0d31gf9a_s13_p1
MAXCDB_C_LEVEL0_20240803_0b31gf98
MAXCDB_D_LEVEL0_20240803_0431gf8s_s4_p1
MAXCDB_D_LEVEL0_20240803_0531gf8s_s5_p1
MAXCDB_D_LEVEL0_20240803_0631gf8s_s6_p1
MAXCDB_D_LEVEL0_20240803_0731gf93_s7_p1
MAXCDB_D_LEVEL0_20240803_0831gf97_s8_p1
MAXCDB_D_LEVEL0_20240803_0931gf97_s9_p1
MAXCDB_D_LEVEL0_20240803_0a31gf97_s10_p1
MAXCDB_S_LEVEL0_20240803_0c31gf98
ECDSA key fingerprint is SHA256:zZ7IkyYbrgaYCI/gMmp1C68FqwMahKMcMniTfaG/BcY.
ECDSA key fingerprint is MD5:9f:eb:77:48:d9:f9:0a:f1:40:e7:d7:9d:1e:5c:69:8e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'target,192.168.73.135' (ECDSA) to the list of known hosts.
oracle@target's password:
MAXCDB_A_LEVEL0_20240803_0131gf8p_s1_p1 100% 190MB 119.2MB/s 00:01
MAXCDB_A_LEVEL0_20240803_0231gf8p_s2_p1 100% 98MB 118.6MB/s 00:00
MAXCDB_A_LEVEL0_20240803_0331gf8p_s3_p1 100% 1024KB 88.0MB/s 00:00
MAXCDB_A_LEVEL0_20240803_0d31gf9a_s13_p1 100% 112KB 35.7MB/s 00:00
MAXCDB_C_LEVEL0_20240803_0b31gf98 100% 18MB 95.8MB/s 00:00
MAXCDB_D_LEVEL0_20240803_0431gf8s_s4_p1 100% 785MB 86.0MB/s 00:09
MAXCDB_D_LEVEL0_20240803_0531gf8s_s5_p1 100% 723MB 90.3MB/s 00:08
MAXCDB_D_LEVEL0_20240803_0631gf8s_s6_p1 100% 350MB 71.2MB/s 00:04
MAXCDB_D_LEVEL0_20240803_0731gf93_s7_p1 100% 254MB 67.7MB/s 00:03
MAXCDB_D_LEVEL0_20240803_0831gf97_s8_p1 100% 220MB 89.7MB/s 00:02
MAXCDB_D_LEVEL0_20240803_0931gf97_s9_p1 100% 218MB 109.0MB/s 00:02
MAXCDB_D_LEVEL0_20240803_0a31gf97_s10_p1 100% 86MB 85.7MB/s 00:00
MAXCDB_S_LEVEL0_20240803_0c31gf98 100% 112KB 15.4MB/s 00:00
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@source dbs]$ ls
hc_maxcdb.dat init.ora orapwmaxcdb spfilemaxcdb.ora
initmaxcdb.ora lkMAXCDB snapcf_maxcdb.f
oracle@target's password:
initmaxcdb.ora 100% 1220 618.4KB/s 00:00
[oracle@source dbs]$
[oracle@target backup]$ mkdir -p /u01/app/oracle/oradata/MAXCDB/
[oracle@target backup]$ mkdir -p /u01/app/oracle/fast_recovery_area/MAXCDB/
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
LRM-00109: could not open parameter file '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initorclcdb.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1073737800 bytes
Fixed Size 8904776 bytes
Variable Size 276824064 bytes
Database Buffers 784334848 bytes
Redo Buffers 3674112 bytes
database closed
database dismounted
Oracle instance shut down
Oracle instance started
Total System Global Area 2365584784 bytes
Fixed Size 9180560 bytes
Variable Size 536870912 bytes
Database Buffers 1811939328 bytes
Redo Buffers 7593984 bytes
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to auxiliary database: MAXCDB (not mounted)
searching for database ID
found backup of database ID 2567024698
sql statement: alter pluggable database all open
Finished Duplicate Db at 03-AUG-24
Tags
RMAN