Backup-Based RMAN
Duplicate/Cloning flow:
·
Source DB থেকে
Backup নাও
o Full database backup (Datafiles, Controlfile, SPFILE, Archive Logs)
· Backup files Target Server এ নাও
o Either network দিয়ে copy করতে পারো বা physical storage ব্যবহার করতে পারো
· Target Server এ RMAN দিয়ে Duplicate চালাও
o RMAN backup থেকে restore করবে এবং নতুন database তৈরি করবে
RMAN AUXILIARY / - নতুন বা empty database কে connect করলাম OS authentication দিয়ে (username/password লাগবে না)
Ü
TARGET = মূল
database (source)
Ü AUXILIARY = নতুন database (duplicate / clone)
DUPLICATE DATABASE TO targetDB
FROM BACKUPSET
BACKUP LOCATION '/backup/location/';
·
DUPLICATE DATABASE TO targetDB - একটা নতুন database বানাও যার নাম হবে targetDB
· FROM BACKUPSET - বলে RMAN কে backup files থেকেই restore করতে হবে
· BACKUP LOCATION '/backup/location/' - backup files কোথায় আছে সেটা specify করে
RMAN internally করে
· Control file restores করে target DB এ copy করে
· Datafiles restore করে target DB location এ
· Archive logs restore করে apply করে, যদি point-in-time recovery দরকার হয়
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;
}
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
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
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]$
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 form backupset backup location '/u01/backup' ;
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
RMAN Active
duplication/cloning to another Server flow:
·
সরাসরি
source database চালু
থাকা অবস্থায় target সার্ভারে duplicate তৈরি করা হয়
· Source থেকে data সরাসরি target এ পাঠানো হয়, Backup এর দরকার নেই
· Data network এর মাধ্যমে পাঠানো হয়
· TARGET sys/oracle@maxcdb_source - source DB এর সাথে connect
· AUXILIARY / - target DB (clone) এর সাথে OS authentication দিয়ে connect
· NOFILENAMECHECK - RMAN duplicate করার সময় filename/path check skip করে, আগের file overwrite করেও duplicate তৈরি করবে
· FROM ACTIVE DATABASE - source database চালু থাকা অবস্থায় data নিয়ে duplicate বানাও
DUPLICATE DATABASE TO targetDB
FROM ACTIVE DATABASE
NOFILENAMECHECK;
SERVER 01 PROD (source)
step 01: create pfile if does not exist
[oracle@prod ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 3 23:38:54 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
step 02: Transfer pfile to server 2 (Target Database)
[oracle@prod ~]$ cd $ORACLE_HOME/dbs
initmaxcdb.ora | orapwmaxcdb
[oracle@prod dbs]$ scp initmaxcdb.ora oracle@192.168.73.135:$ORACLE_HOME/dbs
oracle@192.168.73.135's password:
initmaxcdb.ora 100% 1220 679.4KB/s 00:00
step 03: Transfer password files to server 2 (target database)
[oracle@prod dbs]$ scp orapwmaxcdb oracle@192.168.73.135:$ORACLE_HOME/dbs
oracle@192.168.73.135's password:
orapwmaxcdb 100% 2048 1.0MB/s 00:00
SERVER 02 DEV (target)
step 04: add an entry in oratab
[oracle@clone ~]$ vi /etc/oratab
maxcdb:/u01/app/oracle/product/19.0.0/dbhome_1:N
step 05: create necessary directories
[oracle@clone ~]$ mkdir -p /u01/app/oracle/admin/maxcdb/adump
[oracle@clone ~]$ mkdir -p /u01/app/oracle/oradata/MAXCDB/
[oracle@clone ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/MAXCDB/
step 06: set TNS entry for source database
[oracle@clone admin]$ vi tnsnames.ora
MAXCDB_SOURCE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.73.134)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = maxcdb)
)
)
step 07: verify TNS entry
[oracle@clone ~]$ tnsping maxcdb_source
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 03-AUG-2024 23:59:46
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.73.134)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = maxcdb)))
OK (0 msec)
step 08: startup database in nomount mode
[oracle@clone ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 4 00:00:21 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1828714320 bytes
Fixed Size 9135952 bytes
Variable Size 436207616 bytes
Database Buffers 1375731712 bytes
Redo Buffers 7639040 bytes
step 09: duplicate database
[oracle@clone ~]$ rman target sys/oracle@maxcdb_source auxiliary /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Aug 4 00:03:04 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)
connected to auxiliary database: MAXCDB (not mounted)
RMAN> duplicate database to maxcdb from active database nofilenamecheck;
Starting Duplicate Db at 04-AUG-24
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=237 device type=DISK
sql statement: alter pluggable database all open
Cannot remove created server parameter file
Finished Duplicate Db at 04-AUG-24
o Full database backup (Datafiles, Controlfile, SPFILE, Archive Logs)
· Backup files Target Server এ নাও
o Either network দিয়ে copy করতে পারো বা physical storage ব্যবহার করতে পারো
· Target Server এ RMAN দিয়ে Duplicate চালাও
o RMAN backup থেকে restore করবে এবং নতুন database তৈরি করবে
Ü AUXILIARY = নতুন database (duplicate / clone)
FROM BACKUPSET
BACKUP LOCATION '/backup/location/';
· FROM BACKUPSET - বলে RMAN কে backup files থেকেই restore করতে হবে
· BACKUP LOCATION '/backup/location/' - backup files কোথায় আছে সেটা specify করে
· Control file restores করে target DB এ copy করে
· Datafiles restore করে target DB location এ
· Archive logs restore করে apply করে, যদি point-in-time recovery দরকার হয়
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;
}
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
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
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]$
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 form backupset backup location '/u01/backup' ;
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
· Source থেকে data সরাসরি target এ পাঠানো হয়, Backup এর দরকার নেই
· Data network এর মাধ্যমে পাঠানো হয়
· TARGET sys/oracle@maxcdb_source - source DB এর সাথে connect
· AUXILIARY / - target DB (clone) এর সাথে OS authentication দিয়ে connect
· NOFILENAMECHECK - RMAN duplicate করার সময় filename/path check skip করে, আগের file overwrite করেও duplicate তৈরি করবে
· FROM ACTIVE DATABASE - source database চালু থাকা অবস্থায় data নিয়ে duplicate বানাও
FROM ACTIVE DATABASE
NOFILENAMECHECK;
step 01: create pfile if does not exist
[oracle@prod ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 3 23:38:54 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
step 02: Transfer pfile to server 2 (Target Database)
[oracle@prod ~]$ cd $ORACLE_HOME/dbs
initmaxcdb.ora | orapwmaxcdb
[oracle@prod dbs]$ scp initmaxcdb.ora oracle@192.168.73.135:$ORACLE_HOME/dbs
oracle@192.168.73.135's password:
initmaxcdb.ora 100% 1220 679.4KB/s 00:00
step 03: Transfer password files to server 2 (target database)
[oracle@prod dbs]$ scp orapwmaxcdb oracle@192.168.73.135:$ORACLE_HOME/dbs
oracle@192.168.73.135's password:
orapwmaxcdb 100% 2048 1.0MB/s 00:00
SERVER 02 DEV (target)
step 04: add an entry in oratab
[oracle@clone ~]$ vi /etc/oratab
maxcdb:/u01/app/oracle/product/19.0.0/dbhome_1:N
step 05: create necessary directories
[oracle@clone ~]$ mkdir -p /u01/app/oracle/admin/maxcdb/adump
[oracle@clone ~]$ mkdir -p /u01/app/oracle/oradata/MAXCDB/
[oracle@clone ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/MAXCDB/
step 06: set TNS entry for source database
[oracle@clone admin]$ vi tnsnames.ora
MAXCDB_SOURCE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.73.134)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = maxcdb)
)
)
step 07: verify TNS entry
[oracle@clone ~]$ tnsping maxcdb_source
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 03-AUG-2024 23:59:46
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.73.134)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = maxcdb)))
OK (0 msec)
step 08: startup database in nomount mode
[oracle@clone ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 4 00:00:21 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1828714320 bytes
Fixed Size 9135952 bytes
Variable Size 436207616 bytes
Database Buffers 1375731712 bytes
Redo Buffers 7639040 bytes
step 09: duplicate database
[oracle@clone ~]$ rman target sys/oracle@maxcdb_source auxiliary /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Aug 4 00:03:04 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)
connected to auxiliary database: MAXCDB (not mounted)
RMAN> duplicate database to maxcdb from active database nofilenamecheck;
Starting Duplicate Db at 04-AUG-24
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=237 device type=DISK
sql statement: alter pluggable database all open
Cannot remove created server parameter file
Finished Duplicate Db at 04-AUG-24
Tags
BN_Content