Sie sind auf Seite 1von 4

CLONE SAMPLE By SAUMYA RANJAN

Steps from clone DB from production to test


Source SID: PROD (RAC)
New Instance: COPY (Non-RAC)
1) Check the volume details (Incase of NAS volumes)
2) unmount the volume (Incase of NAS volumes.)
3) Mount it on Production server (Incase of NAS volumes)
4) Change owner of the folders which in that mountpoint to id of the server where it is mounted. This step is
required because the ownership of the volume will get changed once you unmount and mount.
5) Keep the home same as prod (this is use to start the new db in nomount stage using prod..can use any
home)
5a) ORACLE_SID=COPY; export ORACLE_SID (SID which u want to clone to be)
6) Change the PATH and LD_LIBRARY_PATH and ORACLE_HOME. Also create a password file for the
new instance.
Orapwd file=orapwCOPY password=XXXXX
7) Make a new pfile for the COPY instance. This pfile should not be copied from any RAC enabled databases.
The new pfile should contain the db_file_convert and log_file_convert parameters. These parameters are used
to inform RMAN where to copy the datafiles for the COPY instance. Also, change the path of the control file,
udump, bdump and cdump, utl_file_dir. Also, change the db_name and db_unique_name parameter.
log_file_name_convert= ('+PRODOTH01', '/oatm') (If you have 2 member located in different volumes then
mention both the paths in the log_file_name_convert parameter.
db_file_name_convert=(+PRODDATA01,/u01, PRODINDEX01,/u02 .)
8) startup nomount pfile = '$ORACLE_HOME/dbs/initCOPY.ora'
9) Make and entry in tnsnames.ora for the new instance. And also, you need to create a new listener in the
listener.ora
Here is a example of an entry in listener.ora
PSUAT =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.33.193.205)(PORT = 1521))
)
)
SID_LIST_PSUAT=
(SID_LIST =
(SID_DESC =
(SID_NAME = PSUAT)
(ORACLE_HOME = /racbin/pshome)
)
)

10) lsnrctl start COPY (change listner.ora and put the hostname where it is mounted)
11) ORACLE_SID=PROD;export ORACLE_SID ( This step is optional depending upon how you connect to
target and auxiliary in RMAN)
12) rman trace '/home/oratest/clon_test_15jan08.txt'
13) debug on (Optional)
14) connect target sys/<>@PROD
16) connect auxiliary sys/pwd@COPY
17) CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
18) run {
set until time "to_date('10-SEPT-2009:08:00:00','DD-Mon-YYYY:HH24:MI:SS')";
duplicate target database to 'PSUAT' ;
}
Once the above step is completed, your new instance will be opened automatically by RMAN.
19)
Stop the database using the NORMAL option
Start the database in mount stage.
Change the database to noarchivelog mode.
Shutdown the database.
Startup.
If this restoration has been done on a NAS volume, then you can shutdown the database, unmount the volume
and mount it to the new server. Once you mount the volume on the new server, ensure that you change the
permissions of all the folders.
==============================================================================
2nd Method :To take backup on the drive which is mounted on 10.33.193.10
1) Take the backup on the mount point which is mounted on 10.33.193.10 server.
RUN {
ALLOCATE CHANNEL ch00 TYPE DISK format '/XXXXX/bk_%s_%p_%t.bkp';
BACKUP DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
ALLOCATE CHANNEL ch00 TYPE DISK format '/XXXXX/ctrl_%s_%p_%t.bkp';
BACKUP CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
2) After successful completion of backup,unmount and mount the same on new server. The target database
server should have access to the volume where the production backup
3) Copy the home on new server (e.g. 10.33.193.205) if it doesnot exist.
on new server (e.g. 10.33.193.205 carry following steps)
4) change owner of the folders which in that mountpoint to id of the server where it is mounted

5) keep the home same as prod (this is use to start the new db in nomount stage using prod..can use any home)
6) ORACLE_SID=PROD;export ORACLE_SID (SID which u want to clone to be..here it will be PROD as
we wnt same SID name)
7) change the PATH and LD_LIBRARY_PATH
8) change exising init.ora or copy from new if it doesnot exist.(SID/udump/bdump/cdump/control file
path/iFile path)
9) in ifile change db file convert.
10) sqlplus / as sysdba
11) startup nomount pfile = '$ORACLE_HOME/dbs/initCOPY.ora' (init.ora file created/modified in step8)
12) TNS_ADMIN = '/oracle/10ghome/10.2.0/network/admin/DEV_wninmumfinprod';export TNS_ADMIN
(also change tnsnames.ora and put entry of the instance e.g. PROD)
13) changes entries in listner.ora e.g.
SID_LIST_COPY =
(SID_LIST =
(SID_DESC =
(SID_NAME = COPY)
(ORACLE_HOME = /racbin/testhome/dbhome)
)
)
COPY =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.33.193.10)(PORT = 1524))
)
)

also put PROD (old server) tns entry so that we can connect to old database through RMAN
14) lsnrctl start PROD (change listner.ora and put the hostname where it is mounted)
15) rman trace '/home/oratest/clon_test_15jan08.txt'
16) debug on
17) connect target sys/pwd@PROD (which should connect to old database)
18) sql "alter session set optimizer_mode=RULE";
19) connect auxiliary sys/pwd@PROD (this PROD is on new server...create sys pwd with orapwd)
20) CONFIGURE DEFAULT DEVICE TYPE TO DISK;
If following is not there do following but do with proper guidance only

ln -s /usr/openv/netbackup/bin/libobk.so64.1 libobk.so

20) export ORACLE_SID=test


Startup nomount
exit
Rman target sys@PROD auxiliary /
21) run {
Set until time to_date(09-Oct-2009:13:00:00, 'DD-Mon-YYYY:HH24:MI:SS')";
Duplicate target database to TEST;
}
21) run {
set until time "to_date('16-Nov-2009:16:30:00','DD-Mon-YYYY:HH24:MI:SS')";
duplicate target database to 'FINUAT;
}
set pagesize 20000
set linesize 180
set pause off
set serveroutput on
set feedback on
set echo on
set numformat 999999999999999
Spool recovery_info.txt
select substr(name, 1, 50), status from v$datafile;
select substr(name,1,40), recover, fuzzy, checkpoint_change# from v$datafile_header;
select GROUP#,substr(member,1,60) from v$logfile;
select * from v$recover_file;
select distinct status from v$backup;
select hxfil FILENUMBER,fhsta STATUS,fhscn SCN,fhrba_Seq SEQUENCE from x$kcvfh;
select distinct (fuzzy) from v$datafile_header;
spool off
exit

Das könnte Ihnen auch gefallen