How to duplicate a database FROM ACTIVE DATABASE with rman for 11g version without backup with different directories.
Sumary:
With this method we do not need a previous backup from the source database. The database cloning is performed through the network using rman script.
Is important that source database be in archive mode and both databases (source and target databases) are of 11g version onwards.
For this scenario the source database and destination database will have differents directories for control file, datafiles, redologs and tempfiles.
1- This is the information for two database environtments :
Primary server : 10.1.0.1
target server : 10.1.0.2 (Destiny server)
Primary DB : TST
Target DB : TSTAUX (Database to be copied)
2- In both servers under $ORACLE_HOME/network/admin in tnsnames.ora set the following entries :
TST_DB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.0.1)(PORT = 1529))
(CONNECT_DATA =
(SID = tst)
)
)
TSTAUX_DB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.0.2)(PORT = 1529))
(CONNECT_DATA =
(SID = tstaux)
)
)
3- On the TSTAUX server under $ORACLE_HOME/dbs create pfile/spfile.
You could use same spfile from TST database, but you'll need to change db_name to tstaux in target database in that case.
4- Connect to the TSTAUX_DB database and change the control file, redolog files and datafiles structures :
sqlplus / as sysdba
startup nomount
alter system set control_files='/o1/oracle11/tst/control01.ctl','/o2/oracle11/tst/control02.ctl','/o3/oracle11/tst/control03.ctl' scope=spfile;
alter system SET LOG_FILE_NAME_CONVERT='/data1/oracle11/tst/','/o1/oracle11/tstaux/','/data2/oracle11/tst/','/o2/oracle11/tstaux/','/data3/oracle11/tst/','/o3/oracle11/tstaux/' scope=spfile;
alter system SET DB_FILE_NAME_CONVERT='/data1/oracle11/tst/','/o1/oracle11/tstaux/','/data2/oracle11/tst/','/o2/oracle11/tstaux/','/data3/oracle11/tst/','/o3/oracle11/tstaux/','/data4/oracle11/tst/','/o1/oracle11/tstaux/','/data5/oracle11/tst/','/o2/oracle11/tstaux/' scope=spfile;
In order change takes effect restart the tstaux database with nomount status.
shutdown immediate
startup nomount
5- You'll need a password file under $ORACLE_HOME/dbs (if is not already there) in primary server.
orapwd file=orapwTST password=password1 entries=30
Copy this "orapwTST" file from $ORACLE_HOME/dbs from primary server to stand-by server under same location with "orapwTSTAUX" name.
On TST database, database sys password MUST be same than orapwTST that you created.
6- TST database must be in archive mode, in case not do the following :
shutdown immediate
startup mount;
alter database archivelog;
alter database open;
7- On tst database connect with rman :
rman target sys/password1@TST_DB auxiliary sys/password1@TSTAUX_DB
8- From tst server execute rman command duplicate :
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
DUPLICATE TARGET DATABASE TO tstaux FROM ACTIVE DATABASE NOFILENAMECHECK;
release channel prmy1;
release channel prmy2;
release channel prmy3;
release channel prmy4;
release channel stby;
}
9- After database cloning, reset LOG_FILE_NAME_CONVERT and DB_FILE_NAME_CONVERT parameters on tstaux database.
sqlplus / as sysdba
alter system reset LOG_FILE_NAME_CONVERT scope=spfile sid='*';
alter system reset DB_FILE_NAME_CONVERT scope=spfile sid='*';
shutdown immediate
startup
Comments