Hello Everyone,
Below is tested in my environment and i have done refresh successfully using this method. Following will be backup based duplicate with no production downtime. Here i have done the refresh for oracle e-business suite.
DB
CLONING – RMAN DUPLICATE (Backup based)
Source
|
Target
|
|
Host name
|
ORAPROD
|
ORACLONE
|
Instance name
|
PROD
|
CLONE
|
Preclone in Prod dbTier :
Go to /u01/oracle/PROD/11.2.0/appsutil/scripts/PROD_oraprod
Perl adpreclone.pl
dbTier
Please make
sure stage created successfully.
Login to clone
server :
Create directory
for clone oracle home.
Mkdir –p /a02/oraclone/CLONE/11.2.0
Mkdir –p /a02/oraclone/CLONE/data
Copy oracle
home from prod to clone server.
(Note : Copy
only oracle home, don’t copy any db files since we will duplicating the db
through RMAN.)
Adcfgclone in CLONE server :
Once oracle
home copied to clone server, Execute the below.
Go to
$ORACLE_HOME/clone/bin
Perl adcfgclone.pl
dbTechStack
dbTechSTack –
It will configure the clone oracle home and will make necessary directories and
configuration files for clone instance.
Once
adcfgclone.pl completes successfully, we can get the env file clone instance
under $ORACLE_HOME. We can use the populated env file for clone instance.
Backup the production database :
Go to prod
server :
Cd /tmp/sikky/rman/scripts/
Backup the
production database, archive logs and control files.
Use the below
command :
Nohup rman
cmdfile= full_bkp_ar_cf.rcv log= full_bkp_ar_cf.log &
Make sure
rman completed without any error.
Script used :
connect
target sys/sys123
RUN
{
ALLOCATE CHANNEL t1 DEVICE TYPE DISK
MAXPIECESIZE = 8G;
ALLOCATE CHANNEL t2 DEVICE TYPE DISK
MAXPIECESIZE = 8G;
ALLOCATE CHANNEL t3 DEVICE TYPE DISK
MAXPIECESIZE = 8G;
ALLOCATE CHANNEL t4 DEVICE TYPE DISK
MAXPIECESIZE = 8G;
ALLOCATE CHANNEL t5 DEVICE TYPE DISK
MAXPIECESIZE = 8G;
backup as compressed backupset incremental
level 0 FILESPERSET 4
format
'/export/home/oracle/PROD/backup/FULL_%d_%U'
(database);
RELEASE CHANNEL t1 ;
RELEASE CHANNEL t2 ;
RELEASE CHANNEL t3 ;
RELEASE CHANNEL t4 ;
RELEASE CHANNEL t5 ;
sql 'alter system archive log current';
backup
filesperset 20
format
'/export/home/oracle/PROD/backup/ar_%t_%s_%p'
(archivelog all);
backup
format
'/export/home/oracle/PROD/backup/cf_%d_%U'
(current controlfile);
}
Above script can be used to backup the full database, archive logs and current control file.
Move backup pieces to Clone :
Check the
directories where backup pieces have been stored in Prod server. Create the
same directory structure in clone server.
Mkdir –p /export/home/oracle/PROD/backup
(Please create a similar directory in clone server like prod to avoid any irrelevant errors)
Scp the
backup pieces from prod to clone.
Cd /export/home/oracle/PROD/backup
Scp *
oraclone@oraclone: /export/home/oracle/PROD/backup/
TNSNAMES.ORA :
Make sure
both servers able to ping with each other. Add the both instance tns entries in
both tnsnames.ora
Prod :
PROD=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oraprod.ebs.com)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=PROD)
(INSTANCE_NAME=PROD)
)
)
CLONE =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oraclone)(PORT=1542))
(CONNECT_DATA=(SID=CLONE))
)
Clone :
CLONE =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oraclone)(PORT=1542))
(CONNECT_DATA=(SID=CLONE))
)
PROD=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oraprod.ebs.com)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=PROD)
(INSTANCE_NAME=PROD)
)
)
Orapwd creation :
Please make
sure both oracle homes have password file with same password.
orapwd
file=$ORACLE_HOME/dbs/orapwPROD password=sys123 entries=4
orapwd
file=$ORACLE_HOME/dbs/orapwCLONE password=sys123 entries=4
Please read my blog once before you do the above. It may be helpful to create password file.
http://sikkyappsdba.blogspot.com/2016/10/ora-01994-grant-failed-password-file.html
Pfile creation :
If prod is
running with spfile create a pfile from spfile and scp it to clone server.
$sqlplus / as
sysdba
SQL >
create pfile from spfile;
Scp pfile to
$ORACLE_HOME/dbs to clone server.
Edit the
pfile and update the below parameters.
db_name = CLONE
control_files = /a02/oraclone/CLONE/data/cntrl01.dbf,/a02/oraclone/CLONE/data/cntrl02.dbf,/a02/oraclone/CLONE/data/cntrl03.dbf
db_file_name_convert='/u01/oracle/PROD/data','/a02/oraclone/CLONE/data'
log_file_name_convert='/u01/oracle/PROD/data','/a02/oraclone/CLONE/data'
Clone
instance :
Once pfile is
created start the instance in nomount.
sqlplus / as sysdba
startup nomount pfile=initCLONE.ora
RMAN Connectivity :
Check whether
you are able to connect to both database through RMAN.
Rman>
connect target sys/sys123@PROD
RMAN>
connect auxiliary sys/sys123@CLONE
Nohup rman cmdfile=
dup_bkp.rcv log= dup_bkp.rcv &
Script used :
connect
auxiliary sys/change_on_install@CLONE
connect
target sys/change_on_install@PROD
RUN
{
ALLOCATE
AUXILIARY CHANNEL ch01 device type disk;
ALLOCATE
AUXILIARY CHANNEL ch02 device type disk;
ALLOCATE
CHANNEL ch03 device type disk;
ALLOCATE
CHANNEL ch04 device type disk;
duplicate
target database to 'CLONE';
RELEASE
CHANNEL ch01;
RELEASE
CHANNEL ch02;
RELEASE
CHANNEL ch03;
RELEASE
CHANNEL ch04;
}
RMAN will do the rest. Just sit and monitor the logs.
Output :
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 24-OCT-16
released channel: ch01
released channel: ch02
released channel: ch03
released channel: ch04
Recovery Manager complete.
RMAN will do the refresh and will open the database. It is recommended to Create spfile once and bounce the database.
No comments:
Post a Comment