RMAN Duplicate Active Database Clone Oracle 12c
I was doing a 12c database clone from one server to another server using active duplicate method.
Why I am doing this is an interesting series. with more to come.
Now lets focus on this post
Source System:
DB Name: FUAT
Server Name: funebs122.lab
IP: 192.168.56.120
Oracle Home: /oraapps122/DATABASE/FUAT/12.1.0
OS: OEL7.9
OS user: oracle
Target System:
DB Name: HIMS
Server Name: funebs122clone.lab
IP: 192.168.56.121
Oracle Home: /oraapps122/DATABASE/FUAT/12.1.0
OS : OEL7.9
OS user: oracle
My Oracle Home path is same as I have made a clone copy of server. But it can be different path as well.
Steps:
1) Check the Source database is in archive mode and up and running.
3) Copy password file from source to target oracle home
If password file is not present create on source and then copy.
[oracle@funebs122 dbs]$ orapwd file=orapwFUAT password=oracle123 entries=10 force=y
Enter password for SYS:
[oracle@funebs122 dbs]$ ls -tlr orapwFUAT
-rw-r-----. 1 oracle oinstall 7680 Feb 2 21:55 orapwFUAT
[oracle@funebs122 dbs]$ scp orapwFUAT oracle@funebs122clone.lab:/oraapps122/DATABASE/FUAT/12.1.0/dbs/
The authenticity of host 'funebs122clone.lab (192.168.56.121)' can't be established.
ECDSA key fingerprint is SHA256:mh4/CAm6STmfkcJgpiKKH9eRgyI7l0UXXOsJlA6cj2g.
ECDSA key fingerprint is MD5:83:c9:3c:b7:2b:30:85:0e:49:d5:67:82:d3:66:d8:fd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'funebs122clone.lab,192.168.56.121' (ECDSA) to the list of known hosts.
oracle@funebs122clone.lab's password:
orapwFUAT 100% 7680 1.8MB/s 00:00
Because we are cloning with different SID copy the password file to clone name
cp orapwFUAT orapwHIMS
4) Create pfile on source database and copy to target.
[oracle@funebs122 dbs]$ scp initFUAT.ora oracle@funebs122clone.lab:/oraapps122/DATABASE/FUAT/12.1.0/dbs/
oracle@funebs122clone.lab's password:
initFUAT.ora 100% 9780 211.4KB/s 00:00
5) Edit the init file on target and create which ever required directories on the target system based on the init file changes.
As my target database name will be HIMS, I will change all the FAUT to HIMS and also change initfile name from initFUAT.ora to initHIMS.ora.
[oracle@funebs122clone dbs]$ mv initFUAT.ora initHIMS.ora
Find all the new directories in initfile and create on target server from oracle user.
I have created all these directories based on my init file
mkdir -p /oraapps122/DATABASE/HIMS
mkdir -p /oraapps122/DATABASE/HIMS/admin/trace
mkdir -p /oraapps122/DATABASE/HIMS/data
mkdir -p /oraapps122/DATABASE/HIMS/admin/cdump
mkdir -p /oraapps122/DATABASE/HIMS/admin
mkdir -p /oraapps122/DATABASE/HIMS/data/archive
mkdir -p /oraapps122/DATABASE/HIMS/appsutil/outbound
Also set the db and log file name convert in the initHIMS.ora file.
*.db_file_name_convert='/oracleapps/DATABASE/FUAT/data/','/oraapps122/DATABASE/HIMS/data/'
*.log_file_name_convert='/oracleapps/DATABASE/FUAT/data/','/oraapps122/DATABASE/HIMS/data/'
*.db_name='HIMS'
6) Create a Environment file for the target database HIMS
[oracle@funebs122clone ~]$ cat HIMS_db.env
export ORACLE_HOME=/oraapps122/DATABASE/FUAT/12.1.0
export ORACLE_BASE=/oraapps122/DATABASE
export ORACLE_SID=HIMS
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib:/lib
export TNS_ADMIN=${ORACLE_HOME}/network/admin
export PATH=$ORACLE_HOME/bin:$PATH
7) Configure Listener and TNS for both Source and Target.
cd $ORACLE_HOME/network/admin
On source
listener.ora
FUAT =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = funebs122.lab)(PORT = 1551))
)
)
SID_LIST_FUAT =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME= /oraapps122/DATABASE/FUAT/12.1.0)
(SID_NAME = FUAT)
)
)
tnsnames.ora
Add entry
SOURCE-FUAT=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = funebs122.lab)(PORT = 1551)))(CONNECT_DATA =(ORACLE_SID = FUAT)))
CLONE-HIMS=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = funebs122clone.lab)(PORT = 1558)))(CONNECT_DATA =(ORACLE_SID = HIMS)))
On Target
listener.ora
HIMS =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = funebs122clone.lab)(PORT = 1558))
)
)
SID_LIST_HIMS =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME= /oraapps122/DATABASE/FUAT/12.1.0)
(SID_NAME = HIMS)
)
)
tnsnames.ora
Add entry
SOURCE-FUAT=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = funebs122.lab)(PORT = 1551)))(CONNECT_DATA =(ORACLE_SID = FUAT)))
CLONE-HIMS=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = funebs122clone.lab)(PORT = 1558)))(CONNECT_DATA =(ORACLE_SID = HIMS)))
8) Open HIMS database in nomount stage
Source the environment created in step 6.
SYS@HIMS >startup nomount pfile='/oraapps122/DATABASE/FUAT/12.1.0/dbs/initHIMS.ora';
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2926472 bytes
Variable Size 754976888 bytes
Database Buffers 1375731712 bytes
Redo Buffers 13848576 bytes
9) Now it's time for RMAN duplication.
On Target, server connect to rman and start the active duplication process.
Auxiliary(HIMS) database give same password as FUAT(sys/oracle123)
[oracle@funebs122clone dbs]$ rman target sys/oracle123@SOURCE-FUAT auxiliary sys/oracle123
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Feb 2 23:16:48 2022
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: FUAT (DBID=790651821)
connected to auxiliary database: HIMS (not mounted)
RMAN> run{
duplicate target database to 'HIMS' from active database NOFILENAMECHECK;
}
Duplication has started.
10) Verify target database once dupication completes
select name,open_mode from v$database;
4 Comments
Nice post
ReplyDeleteHimanshu, two quick questions : 1) On target HIMS server you kept same ORACLE_HOME as source which is "/oraapps122/DATABASE/FUAT/12.1.0". Can we change it to "/oraapps122/DATABASE/HIMS/12.1.0" before or after clone? If so, which way is preferred and how it can be done 2) Will there be performance issue on source (FUAT) database during clong specially if this is production server ? 3) Any files will get changed on source(FUAT) server?
ReplyDeleteThanks
Srinivas
Himanshu, two quick questions : 1) On target HIMS server you kept same ORACLE_HOME as source which is "/oraapps122/DATABASE/FUAT/12.1.0". Can we change it to "/oraapps122/DATABASE/HIMS/12.1.0" before or after clone? If so, which way is preferred and how it can be done 2) Will there be performance issue on source (FUAT) database during clong specially if this is production server ? 3) Any files will get changed on source(FUAT) server?
ReplyDeleteThanks
Srinivas
yes you can change that folder structure. I have mentioned "My Oracle Home path is same as I have made a clone copy of server. But it can be different path as well." Before cloning the database you will need to make sure that the DB home is installed in target server. Use your path which you like.
DeletePost a Comment