Oracle Cloning - Conventional Duplicate Database method
Oracle Cloning - Conventional Duplicate Database method
For DBA Refreshing Table, Schema and Database are routine activity. You can refresh/Clone database using below method:
1.Conventional Restore method and Rename DB post DB Refresh
2.Conventional Duplicate Database method
3. Active database Cloning
4.Backup Base Cloning
We will cover all these methods of cloning in individual blogs. In This blog , We will discuss about how to refresh/Clone Database using Conventional Duplicate Method.
In Conventional Duplicate Method, Target database backup needed to be copied to auxiliary DB server same as that of the target database. In Conventional method if cloning , We need to connect to the target and auxiliary db and backup should be placed on auxiliary db server .
Below are the step followed to perform database cloning using Conventional Duplicate Database method.
1) Copy the RMAN backup files to Auxiliary database server
Note : Directory structure of RMAN backup need to be same on Auxiliary database server.Make symbolic link if required.
2)Prepare Auxiliary database parameter and crate password file for auxiliary database.
Backup the existing password file and parameter file and move the spfile to another name.
Verify the control_file parameter value, RMAN will create control file according to value of this parameter.
Verfify the REMOTE_LOGIN_PASSWORD_FILE , value should be exclusive
Set the
Below parameter temporary to make the Auxiliary database
db_file_name_convert & log_file_name_convert
Note : You can also create your own “set newname for datafile” for all files. In that case need not to set below parameter.
3)Create the password file for remote connection as sysdba
orapwd password=ops_dba file=orapw$ORACLE_SID entries=5
4) Nomount the Auxiliary Database
Sqlplus “/ a sysdba”
Startup nomount pfile= /u01/app/oracle/admin/auxdb/pfile/initauxdb.ora
5)Login to Production database server and Create Auxiliary database
Note : Crosscheck the space on mount point of Auxiliary Database server. Enough space should be available as we have on production server
oraclehost02:oraware->rman trace refresh.log
RMAN> connect target
RMAN> connect auxiliary sys/ops_dba@auxdb
RMAN> duplicate target database to auxdb;
(Check DOC end section, If you want to use SET NEWNAME FOR DATAFILE option . This Option clone database as per our standard environment)
6)Remove the DB_FILE_NAME_CONVERT and LOG_FILE_NAME CONVERT parameter from pfile
7)Create spfile from pfile and bouns auxiliary database.
APPENDIX:
Incase you want to use “SET NEWNAME FOR DATAFILE” option
Note : You can use the below commands to make the SET NEWNAME FOR DATAFILE command and place the same in run command
select 'set newname for datafile '''||name||''' to '''||replace(name,'Prod_SID','Auxiliary_SID ') ||''';' from v$datafile ;
select 'set newname for tempfile '''||name||''' to '''||replace(name,'Prod_sid','Auxiliary_SID') ||''';' from v$tempfile ;
e.g
select 'set newname for datafile '''||name||''' to '''||replace(name,'trgdb','auxdb') ||''';' from v$datafile ;
select 'set newname for tempfile '''||name||''' to '''||replace(name,'trgdb','auxdb') ||''';' from v$tempfile ;
Duplicate command With set new name :
oraclehost01:oraware->rman trace refresh.log
RMAN> connect target
RMAN> connect auxiliary sys/ops_dba@auxdb
RMAN> run
{
set new name for datafile '/u02/oradata/trgdb/trgdb_system_01.dbf' to '/u02/oradata/auxdb/auxdb_system_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_undotbs_01.dbf' to '/u04/oradata/auxdb/auxdb_undotbs_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_sysaux_01.dbf' to '/u02/oradata/auxdb/auxdb_sysaux_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_users_01.dbf' to '/u02/oradata/auxdb/auxdb_users_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_tools_01.dbf' to '/u04/oradata/auxdb/auxdb_tools_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_ASTG_TAB_01.dbf' to '/u02/oradata/auxdb/auxdb_ASTG_TAB_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_CNVACT_IND01_01.dbf' to '/u03/oradata/auxdb/auxdb_CNVACT_IND01_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_CNVACT_IND02_01.dbf' to '/u04/oradata/auxdb/auxdb_CNVACT_IND02_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_CNVACT_TAB_01.dbf' to '/u05/oradata/auxdb/auxdb_CNVACT_TAB_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_COREARCH_01.dbf' to '/u02/oradata/auxdb/auxdb_COREARCH_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_EDI_IND_01.dbf' to '/u03/oradata/auxdb/auxdb_EDI_IND_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_EDI_TAB_01.dbf' to '/u04/oradata/auxdb/auxdb_EDI_TAB_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_EDI_TAB2_01.dbf' to '/u05/oradata/auxdb/auxdb_EDI_TAB2_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_INB_WMS_IND_01.dbf' to '/u02/oradata/auxdb/auxdb_INB_WMS_IND_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_INB_WMS_TAB_01.dbf' to '/u02/oradata/auxdb/auxdb_INB_WMS_TAB_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_INTF_IND_01.dbf' to '/u04/oradata/auxdb/auxdb_INTF_IND_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_INTF_TAB_01.dbf' to '/u05/oradata/auxdb/auxdb_INTF_TAB_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_INVTRAN_IDX_TAB_01.dbf' to '/u02/oradata/auxdb/auxdb_INVTRAN_IDX_TAB_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_ITS_IND_01.dbf' to '/u02/oradata/auxdb/auxdb_ITS_IND_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_ITS_TAB_01.dbf' to '/u04/oradata/auxdb/auxdb_ITS_TAB_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OEORDER_RELEASE_TAB_01.dbf' to '/u05/oradata/auxdb/auxdb_OEORDER_RELEASE_TAB_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_OMSIND_01.dbf' to '/u02/oradata/auxdb/auxdb_OMSIND_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OMSIND2_01.dbf' to '/u03/oradata/auxdb/auxdb_OMSIND2_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_OMSIND3_01.dbf' to '/u04/oradata/auxdb/auxdb_OMSIND3_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSIND4_01.dbf' to '/u05/oradata/auxdb/auxdb_OMSIND4_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_OMSIND5_01.dbf' to '/u02/oradata/auxdb/auxdb_OMSIND5_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OMSIND6_01.dbf' to '/u03/oradata/auxdb/auxdb_OMSIND6_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_OMSTAB_01.dbf' to '/u02/oradata/auxdb/auxdb_OMSTAB_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB2_01.dbf' to '/u05/oradata/auxdb/auxdb_OMSTAB2_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_OMSTAB3_01.dbf' to '/u02/oradata/auxdb/auxdb_OMSTAB3_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OUB_WMS_IND_01.dbf' to '/u03/oradata/auxdb/auxdb_OUB_WMS_IND_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_OUB_WMS_TAB_01.dbf' to '/u04/oradata/auxdb/auxdb_OUB_WMS_TAB_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_SNAPLOG_TAB_01.dbf' to '/u05/oradata/auxdb/auxdb_SNAPLOG_TAB_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OMSTAB4_01.dbf' to '/u03/oradata/auxdb/auxdb_OMSTAB4_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB5_01.dbf' to '/u02/oradata/auxdb/auxdb_OMSTAB5_01.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OMSTAB6_01.dbf' to '/u03/oradata/auxdb/auxdb_OMSTAB6_01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_OMSTAB7_01.dbf' to '/u04/oradata/auxdb/auxdb_OMSTAB7_01.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_OMSTAB7_02.dbf' to '/u02/oradata/auxdb/auxdb_OMSTAB7_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB6_02.dbf' to '/u05/oradata/auxdb/auxdb_OMSTAB6_02.dbf';
set newname for datafile '/u04/oradata/trgdb/sox_user01.dbf' to '/u04/oradata/auxdb/sox_user01.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_ITS_TAB_02.dbf' to '/u04/oradata/auxdb/auxdb_ITS_TAB_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_EDI_TAB2_02.dbf' to '/u05/oradata/auxdb/auxdb_EDI_TAB2_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OUB_WMS_TAB_02.dbf' to '/u05/oradata/auxdb/auxdb_OUB_WMS_TAB_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB5_02.dbf' to '/u05/oradata/auxdb/auxdb_OMSTAB5_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB5_03.dbf' to '/u05/oradata/auxdb/auxdb_OMSTAB5_03.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OMSTAB6_03.dbf' to '/u03/oradata/auxdb/auxdb_OMSTAB6_03.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_OMSTAB_02.dbf' to '/u02/oradata/auxdb/auxdb_OMSTAB_02.dbf';
set newname for datafile '/u02/oradata/trgdb/trgdb_OMSTAB7_03.dbf' to '/u02/oradata/auxdb/auxdb_OMSTAB7_03.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_EDI_IND_02.dbf' to '/u03/oradata/auxdb/auxdb_EDI_IND_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_undotbs_02.dbf' to '/u05/oradata/auxdb/auxdb_undotbs_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB3_02.dbf' to '/u05/oradata/auxdb/auxdb_OMSTAB3_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSIND3_02.dbf' to '/u05/oradata/auxdb/auxdb_OMSIND3_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_soxdata_01.dbf' to '/u05/oradata/auxdb/auxdb_soxdata_01.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_sysaux_02.dbf' to '/u05/oradata/auxdb/auxdb_sysaux_02.dbf';
set newname for datafile '/u05/oradata/trgdb/trgdb_OMSTAB4_02.dbf' to '/u05/oradata/auxdb/auxdb_OMSTAB4_02.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_ITS_IND_02.dbf' to '/u03/oradata/auxdb/auxdb_ITS_IND_02.dbf';
set newname for datafile '/u03/oradata/trgdb/trgdb_OMSTAB2_02.dbf' to '/u03/oradata/auxdb/auxdb_OMSTAB2_02.dbf';
set newname for datafile '/u04/oradata/trgdb/trgdb_users_02.dbf' to '/u04/oradata/auxdb/auxdb_users_02.dbf';
set newname for tempfile '/u04/oradata/trgdb/trgdb_temp_01.dbf' to '/u04/oradata/auxdb/auxdb_temp_01.dbf';
set newname for tempfile '/u04/oradata/trgdb/trgdb_temp2_01.dbf' to '/u04/oradata/auxdb/auxdb_temp2_01.dbf';
set newname for tempfile '/u02/oradata/trgdb/trgdb_temp_02.dbf' to '/u02/oradata/auxdb/auxdb_temp_02.dbf';
set newname for tempfile '/u02/oradata/trgdb/trgdb_temp2_02.dbf' to '/u02/oradata/auxdb/auxdb_temp2_02.dbf';
set until time "to_date('24-04-2008 09:14:00','dd-mm-yyyy hh24:mi:ss' )";
DUPLICATE TARGET DATABASE TO auxdb
LOGFILE
GROUP 2 ('/u03/oradata/auxdb/auxdb_redo_g2_m1.rdo', '/u04/oradata/auxdb/auxdb_redo_g2_m2.rdo' ) SIZE 50M REUSE,
GROUP 4 ('/u02/oradata/auxdb/auxdb_redo_g4_m1.rdo', '/u03/oradata/auxdb/auxdb_redo_g4_m2.rdo') SIZE 20M REUSE,
GROUP 5 ('/u03/oradata/auxdb/auxdb_redo_g5_m1.rdo', '/u04/oradata/auxdb/auxdb_redo_g5_m2.rdo' ) SIZE 20M REUSE,
GROUP 6 ('/u04/oradata/auxdb/auxdb_redo_g6_m1.rdo',
'/u02/oradata/auxdb/auxdb_redo_g6_m2.rdo' ) SIZE 20M REUSE;
}
You can learn more about oracle database administration:
Pro Oracle GoldenGate for the DBA
Oracle Security Tools Installation and Configuration
==========================================================
Please check our other blogs for Refresh
Comments
Post a Comment
Please do not enter any spam link in comment Section suggestions are Always Appreciated. Thanks.. !