Rman Clonning
Rman Clonning
Rman Clonning
$ su – oracle
Password: xxxxxx (Issue the password here)
Check and set the ORACLE_HOME, ORACLE_SID, and other environment variables.
$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0
$ export ORACLE_SID=prod
$ echo $ORACLE_HOME
Note: Oracle user has a profile (.bash_profile) in which all required environment
variables are set, whenever the oracle user logs in to the server the environment
variables are set automatically.
$ vi. .bash_profile
:q!
$ sqlplus / as sysdba
Here in our case the database is already configured for Archive log mode, and the archive log
destination is used by Flash Recovery Area.
If your DB is in no Archive log mode then change the mode to Archive log.
DB_RECOVERY_FILE_DEST=/u03/FRA
DB_RECOVERY_FILE_DEST_SIZE=4G
$ sqlplus / as sysdba
$ export ORACLE_SID=prod
$ rman target /
This command will take the backup of all database files and archived log files, and place them in
flash recovery area (/u03/FRA/PROD/backupsets/__
To check and list the backup taken previously using RMAN’s LIST commands.
$ cd $ORACLE_HOME/dbs
Note: If you do not find the init.ora file for your target instance under the directory
$ORACLE_HOME/dbs, may be you are using spfile or the init.ora file might have kept
somewhere in another location;
If the spfile is being used, then create the pfile from spfile
$ cp –p initPROD.ora initTEST.ora
Edit the initialization parameter file (initTEST.ora) and update the following
parameters accordingly to your clone instance.
USER_DUMP_DEST=
BACKGROUND_DUMP_DEST=
AUDIT_FILE_DEST=
CORE_DUMP_DEST=
USER_DUMP_DEST=
CONTROL_FILES=
DB_NAME=
INSTANCE_NAME=
SERVICE_NAMES=
DB_FILE_CONVERT_NAME=
LOG_FILE_CONVERT_NAME=
Note: In general, cloned instances are not kept in archive log mode, so you can remove or
comment both parameters related to FRA, DB_RECOVERY_FILE_DEST and
DB_RECOVERY_FILE_DEST_SIZE
$ export ORACLE_SID=test
$ cd $ORACLE_HOME/dbs
Note: Make sure that the Production (Target) password and Test (Clone) password for
orapwd file must be same.
Prepare the listener and tnanemes.ora entries for clone (TEST) instance.
$ cd $ORACLE_HOME/network/admin
Open listener.ora file and add the TEST instance entry as below.
(SID_DESC =
(SID_NAME = test)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0)
)
Open tnsnames.ora file and add the TEST instance entry as below.
test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = unicorn.kware) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =test)
)
)
$ tnsping prod
$ tnsping test
$ export ORACLE_SID=test
$ sqlplus / as sysdba
INSTANCE_NAME
-------------------------
test
$ export ORACLE_SID=prod
$ rman target / auxiliary sys/sys@test
RMAN> RUN
2> {
3> ALLOCATE AUXILIARY CHANNEL AUX1 DEVICE TYPE DISK;
4> DUPLICATE TARGET DATABASE TO 'test';
5> }
Above command output will be a self explanatory, please go through the output
generated.
RMAN> exit;
Execute the below steps in Test (Clone) instance, and cross check the result with the
Production (Target) instance.
$ export ORACLE_SID=test
$ sqlplus / as sysdba
If you find invalid objects then you can compile them using
$ORACLE_HOME/rdbms/admin/utlrp.sql
Reference:
http://download-
east.oracle.com/docs/cd/B19306_01/backup.102/b14191/rcmdupdb005.htm
Conclusion:
I have followed the above procedure/steps as per our requirement in the University. I
would request you to follow the complete method and other options from referenced link
above.