Friday, June 24, 2011

Duplicate Oracle database on same host

Source       

sqlplus system/password@source
SQL> select name from v$database;
NAME
---------
source

SQL> select name from v$controlfile;
/u02/oradata/source/control/control01.ctl
/u05/oradata/source/control/control02.ctl
/u06/oradata/source/control/control03.ctl

SQL> select member from v$logfile;
/u06/oradata/source/logfile/redo01b.rdo
/u06/oradata/source/logfile/redo02b.rdo
/u05/oradata/source/logfile/redo01a.rdo
/u05/oradata/source/logfile/redo02a.rdo
destination
SQL> select name from v$database;
NAME
---------
target
SQL> select name from v$controlfile ;
NAME
-------------------------------------------------------------------------------
/u01/app/oracle/oradata/target/control01.ctl
/u01/app/oracle/oradata/target/control02.ctl
/u01/app/oracle/oradata/target/control03.ctl


SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/target/redo03.log
/u01/app/oracle/oradata/targetredo02.log
/u01/app/oracle/oradata/target/redo01.log


Export ORACLE_SID=target
Vi $ORACLE_HOME/dbs/target.ora

*.db_file_name_convert=('/u03/oradata/source/datafiles','/u03/oradata/target/datafiles',
'/u02/oradata/source/datafiles','/u02/oradata/target/datafiles',
'/u02/oradata/source','/u02/oradata/target')
*.log_file_name_convert=('/u05/oradata/source/logfile/','/u01/app/oracle/oradata/target/',
'/u06/oradata/source/logfile/','/u01/app/oracle/oradata/target/')
~
Sqlplus / as sysdba
Shutdown abort;
Startup pfile =’$ORACLE_HOME/dbs/target.ora’;
Create spfile from pfile;
Shutdown abort;
Startup nomount;
Host;
Rman target sys/pass@source
Connect auxiliary /
Duplicate target database to target;

No comments:

Post a Comment