Clone Database on the same machine (locally).
1) First make sure your database is in archivelog mode. 2) Make a fresh backup of your database using Rman. 3) The SID of the database which I have is “orcl”. The cloned database name will be “dup”. 4) Add the following lines to listener.ora file.
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcl) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (SID_NAME = orcl) ) (SID_DESC = (GLOBAL_DBNAME = dup) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (SID_NAME = dup) ) ) LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = canada)(PORT = 1521)) )
5) Add the following lines to tnsnames.ora
ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.94)(PORT = 1521)) ) (CONNECT_DATA = (ORACLE_SID = orcl) ) ) DUP = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.94)(PORT = 1521)) ) (CONNECT_DATA = (ORACLE_SID = dup) ) )
6) After making the changes stop and start the listener or reload it.
lsnrctl stop lsnrctl start or lsnrctl reload
7) Create pfile from the production servers spfile.
SQL> create pfile='/u01/app/oracle/initdup.ora' from spfile;
8) Create the all the adump, bdump, cdump, dpdump, udump , dup directories
for the “dup” database. don't forget to give appropriate
permissions to these directories.
9) Edit the initdup.ora file and change the location of all the files for
the dup database, and
Add the following two parameters at the end.
db_file_name_convert=(/u01/app/oracle/oradata/orcl/,/u01/app/oracle/oradata/dup/) log_file_name_convert=(/u01/app/oracle/oradata/orcl/,/u01/app/oracle/oradata/dup/)
Here is my sample pfile.
dup.__db_cache_size=180355072 dup.__java_pool_size=4194304 dup.__large_pool_size=4194304 dup.__shared_pool_size=92274688 dup.__streams_pool_size=0 *.audit_file_dest='/u01/app/oracle/admin/dup/adump' *.background_dump_dest='/u01/app/oracle/admin/dup/bdump' *.compatible='10.2.0.1.0' *.control_files='/u01/app/oracle/oradata/dup/control01.ctl','/u01/app/oracle /oradata/dup/control02.ctl','/u01/app/oracle/oradata/dup/control03.ctl' *.core_dump_dest='/u01/app/oracle/admin/dup/cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name='dup' *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' *.db_recovery_file_dest_size=2147483648 *.dispatchers='(PROTOCOL=TCP) (SERVICE=dupXDB)' *.job_queue_processes=10 *.log_archive_dest_1='location=/u01/app/oracle/archivelog/dup/' *.log_archive_start=TRUE *.open_cursors=300 *.pga_aggregate_target=94371840 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_target=285212672 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='/u01/app/oracle/admin/dup/udump' *.db_file_name_convert=(/u01/app/oracle/oradata/orcl/,/u01/app/oracle/oradata/dup/) *.log_file_name_convert=(/u01/app/oracle/oradata/orcl/,/u01/app/oracle/oradata/dup/)
10) Create a password file for the new database.
export ORACLE_SID=dup orapwd file=${ORACLE_HOME}/dbs/orapw${ORACLE_SID} password=sys
11) Create spfile for the dup database.
SQL> create spfile from pfile='/u01/app/oracle/initdup.ora';
12) From sqlplus start the dup instance up in nomount stage.
SQL> startup nomount
13) Then open another terminal and connect to rman. It is assumed here
That there is no recovery catalog.
export ORACLE_SID=dup rman target sys@orcl nocatalog auxiliary / RMAN> duplicate target database to dup;
14) Add appropriate entries for the new database in the oratab file in the “/etc/” directory.
Clone Database on the remote machine.
This scenario is exactly the same as described for the local host. Copy the RMAN Backup files to the remote host on the same directory as on the localhost.
example scp /u01/app/backup/* 192.168.1.56:/u01/app/backup/
Also make appropriate entries in the listener.ora & tnsnames.ora
files on the remote host.
0 comments:
Post a Comment