Vous êtes sur la page 1sur 11

Clone with RMAN duplicate

Notify App Oracle (with SD nr) that they have to start copying of the APPS top from environment to environment. In this case from prod to JALL. 1. Pre clone: ************* OEBS database clone routine Routine is created based on metalink note 230672.1 We base on a clone from production to the test environment. Production: Machine: pebsdbc01.posten.no (139.116.144.12) SID: PPOST Gate: 1521 Owner: oracle Test (you get all info in test by Ole Bie, obie@ergogroup.no): Machine: tebsdbd01.posten.no (139.116.156.10) SID: JALL Gate: 1550 -----This will give a gate pool 1550-1521=29 Owner: orajall

Jump to pt. 2.1a in note 230672.1. cd <RDBMS ORACLE_HOME>/appsutil/scripts/<CONTEXT_NAME> perl adpreclone.pl dbTier In prod this will be: -Log on to pebsdbc01.posten.no as users oracle -cd /u01/app/oracle/product/10.2.0/appsutil/scripts/PPOST_pebsdbf01 -perl adpreclone.pl dbTier ####Make sure that you don`t get blank after dbTier ....... You will be asked for the password to database user APPS. The password is APPS. 2. Create $ORACLE_HOME on tebsdbd01.posten.no from $ORACLE_HOME in production 2.1 Log on to tebsdbd01.posten.no as user orajall and run "mkdir oradata DBHOME tmp" 2.2 Log into prod and run "cd $ORACLE_HOME" 2.3 scp -r * orajall@tebsdbd01.posten.no:DBHOME/ 2.4 Check /var/opt/oracle/oraInst.loc on tebsdbd01.posten.no, this must be like this: inventory_loc=/u06/orajall/oraInventory

2.5 Change rights on oratab (chmod a+rw /etc/oratab) 2.6 Jump to "Appendix B: Recreating database control files manually in Rapid Clone." in Note:230672.1 cd <RDBMS ORACLE_HOME>/appsutil/clone/bin perl adcfgclone.pl dbTechStack In our example this will be: cd /u06/orajall/DBHOME/appsutil/clone/bin perl adcfgclone.pl dbTechStack ---See Input/Output under [orajall@tebsdbd01]</u06/orajall/DBHOME/appsutil/clone/bin> perl adcfgclone.pl dbTechStack Enter the APPS password [APPS]: apps First creating a new context file for the cloned system. The program is going to ask you for information about the new system:

Provide the values required for creation of the new Database Context file. Do you want to use a virtual hostname for the target node (y/n) [n] ?: Target instance is a Real Application Cluster (RAC) instance (y/n) [n]: Target System database name [PPOST]:JALL Target system domain name [posten.no]: Target system RDBMS ORACLE_HOME directory [/u01/app/oracle/product/10.2.0]:/u06/orajall/DBHOME Target system utl_file accessible directories list [/usr/tmp]:/u06/orajall/tmp Number of DATA_TOP's on the target system [3]:1 Target system DATA_TOP 1:/u06/orajall/oradata Do you want to preserve the Display set to pebsdbc01:0.0 (y/n) [y] ?:n Target system Display [tebsdbd01:0.0]: Perl executable location is set to: /usr/bin/perl

Do you want to preserve the port values from the source system on the target system (y/n) [y] ?:n Clone Context uses the same port pool mechanism as the Rapid Install Once you choose a port pool, Clone Context will validate the port availability. Enter the port pool number [0-99]: 29 Checking the port pool 29 done: Port Pool 29 is free Database port is 1550 Creating the new Database Context file from : /u06/orajall/DBHOME/appsutil/template/adxdbctx.tmp The new database context file has been created : /u06/orajall/DBHOME/appsutil/JALL_tebsdbd01.xml Log file located at /u06/orajall/DBHOME/appsutil/clone/bin/CloneContext_03130301.log Running Rapid Clone with command: perl /u06/orajall/DBHOME/appsutil/clone/bin/adclone.pl java=/u06/orajall/DBHOME/appsutil/clone/bin/../jre mode=apply stage=/u06/orajall/DBHOME/appsutil/clone/bin/.. component=dbTechStack method=CUSTOM dbctxtg=/u06/orajall/DBHOME/appsutil/JALL_tebsdbd01.xml showProgress contextValidated=true Beginning rdbms home Apply - Thu Mar 13 15:03:36 2008 Log file located at /u06/orajall/DBHOME/appsutil/log/JALL_tebsdbd01/ApplyDBTechStack_03131503.log

Completed Apply... Thu Mar 13 15:08:26 2008 Beginning APPSDB_JALL registration to central inventory... ORACLE_HOME NAME : APPSDB_JALL ORACLE_HOME PATH : /u06/orajall/DBHOME Using Inventory location in /var/opt/oracle/oraInst.loc Log file located at /u06/orajall/oraInventory/logs/OracleHomeCloner_03130308.log ORACLE_HOME /u06/orajall/DBHOME was registered successfully. Starting database listener for JALL:

Running: /u06/orajall/DBHOME/appsutil/scripts/JALL_tebsdbd01/addlnctl.sh start JALL You are running addlnctl.sh version 115.7 Log file: /u06/orajall/DBHOME/appsutil/log/JALL_tebsdbd01/addlnctl.txt Starting listener process JALL ...

addlnctl.sh: exiting with status 0 [orajall@tebsdbd01]</u06/orajall/DBHOME/appsutil/clone/bin> Note! Log out and in again to include new environment 3. Create ini file initJALL.ora 3.1 Copy original initJALL.ora to initJALL.ora_ORIG 3.2 Add this in empty initJALL.ora: background_dump_dest =/u06/orajall/DBHOME/admin/JALL_tebsdbd01/bdump core_dump_dest =/u06/orajall/DBHOME/admin/JALL_tebsdbd01/cdump user_dump_dest =/u06/orajall/DBHOME/admin/JALL_tebsdbd01/udump db_name ='JALL' instance_name =JALL cluster_database=false #(in case the production is a rac environment) # Set the below to the location of the duplicate clone control file. control_files =('/u06/orajall/oradata/cntrl01.ctl','/u06/orajall/oradata/cntrl02.ctl','/u06/orajall/oradata/cntrl03.ctl') # Set the below for the from and to location for all data files / redo # logs to be cloned. db_file_name_convert = ('/temp01d/oradata/PPOST/','/u06/orajall/oradata/') #Set the below to the same as the production target undo_management =AUTO #undo_retention =10800 undo_tablespace =UNDOTBS1 db_block_size = 8192 compatible = 10.2.0.2

3.3 Start the base in nomount.

4. Add this in $TNS_ADMIN/JALL_tebsdbd01_ifile.ora: PPPOST= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1621)) (CONNECT_DATA= (SID=PPOST) ) ) RRMAN= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1629)) (CONNECT_DATA= (SID=RMAN) ) ) 5. Set up tunnels like this: Use screen on the access servers to avoid that the tunnels become dependent on your work station being up and on net: anzu/humbaba/geri/freki: Type "screen" to start Tunnel nr. 1: ssh -g -R 1621:pebsdbc01:1521 tebsdbd01 Leave the window above be, <CTRL>+A - c to start new window in screen Tunnel nr. 2: ssh -g -R 1629:qebsdbc03:1529 tebsdbd01 Press <CTRL>+A - d to "detach" screen 5. Build RMAN script - dup.rcv like this: run { set until time "to_date('2009/03/03 09:00:00','yyyy/mm/dd HH24:MI:SS')"; allocate auxiliary channel C1 device type 'sbt_tape'; allocate auxiliary channel C2 device type 'sbt_tape'; allocate auxiliary channel C3 device type 'sbt_tape'; send 'NB_ORA_SERV=nogvknbma.os.ergo.no,NB_ORA_CLIENT=pebsdbf01'; set newname for datafile '/u21d/oradata/PPOST/system11.dbf' to '/u06/orajall/oradata/system11.dbf'; set newname for datafile '/u21d/oradata/PPOST/system10.dbf' to '/u06/orajall/oradata/system10.dbf'; set newname for datafile '/u21d/oradata/PPOST/system09.dbf' to '/u06/orajall/oradata/system09.dbf';

set newname for datafile '/u21d/oradata/PPOST/system08.dbf' to '/u06/orajall/oradata/system08.dbf'; set newname for datafile '/u21d/oradata/PPOST/system07.dbf' to '/u06/orajall/oradata/system07.dbf'; set newname for datafile '/u21d/oradata/PPOST/system06.dbf' to '/u06/orajall/oradata/system06.dbf'; set newname for datafile '/u21d/oradata/PPOST/system05.dbf' to '/u06/orajall/oradata/system05.dbf'; set newname for datafile '/u21d/oradata/PPOST/system04.dbf' to '/u06/orajall/oradata/system04.dbf'; set newname for datafile '/u21d/oradata/PPOST/system03.dbf' to '/u06/orajall/oradata/system03.dbf'; set newname for datafile '/u21d/oradata/PPOST/system02.dbf' to '/u06/orajall/oradata/system02.dbf'; set newname for datafile '/u21d/oradata/PPOST/system01.dbf' to '/u06/orajall/oradata/system01.dbf'; set newname for datafile '/u20d/oradata/PPOST/sysaux01.dbf' to '/u06/orajall/oradata/sysaux01.dbf'; set newname for datafile '/u17d/oradata/PPOST/undotbs11.dbf' to '/u06/orajall/oradata/undotbs11.dbf'; set newname for datafile '/u17d/oradata/PPOST/undotbs12.dbf' to '/u06/orajall/oradata/undotbs12.dbf'; set newname for datafile '/u02d/oradata/PPOST/apps_ts_archive01.dbf' to '/u06/orajall/oradata/apps_ts_archive01.dbf'; set newname for datafile '/u03d/oradata/PPOST/apps_ts_interface01.dbf' to '/u06/orajall/oradata/apps_ts_interface01.dbf'; set newname for datafile '/u23d/oradata/PPOST/apps_ts_media01.dbf' to '/u06/orajall/oradata/apps_ts_media01.dbf'; set newname for datafile '/u23d/oradata/PPOST/apps_ts_media02.dbf' to '/u06/orajall/oradata/apps_ts_media02.dbf'; set newname for datafile '/u05d/oradata/PPOST/apps_ts_nologging01.dbf' to '/u06/orajall/oradata/apps_ts_nologging01.dbf'; set newname for datafile '/u06d/oradata/PPOST/apps_ts_queues01.dbf' to '/u06/orajall/oradata/apps_ts_queues01.dbf'; set newname for datafile '/u06d/oradata/PPOST/apps_ts_queues02.dbf' to '/u06/orajall/oradata/apps_ts_queues02.dbf'; set newname for datafile '/u06d/oradata/PPOST/apps_ts_queues03.dbf' to '/u06/orajall/oradata/apps_ts_queues03.dbf'; set newname for datafile '/u07d/oradata/PPOST/apps_ts_seed01.dbf' to '/u06/orajall/oradata/apps_ts_seed01.dbf'; set newname for datafile '/u07d/oradata/PPOST/apps_ts_seed02.dbf' to '/u06/orajall/oradata/apps_ts_seed02.dbf'; set newname for datafile '/u08d/oradata/PPOST/apps_ts_summary01.dbf' to '/u06/orajall/oradata/apps_ts_summary01.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data08.dbf' to '/u06/orajall/oradata/apps_ts_tx_data08.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data01.dbf' to '/u06/orajall/oradata/apps_ts_tx_data01.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data02.dbf' to '/u06/orajall/oradata/apps_ts_tx_data02.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data03.dbf' to '/u06/orajall/oradata/apps_ts_tx_data03.dbf';

set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data04.dbf' to '/u06/orajall/oradata/apps_ts_tx_data04.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data05.dbf' to '/u06/orajall/oradata/apps_ts_tx_data05.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data09.dbf' to '/u06/orajall/oradata/apps_ts_tx_data09.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data06.dbf' to '/u06/orajall/oradata/apps_ts_tx_data06.dbf'; set newname for datafile '/u10d/oradata/PPOST/apps_ts_tx_data07.dbf' to '/u06/orajall/oradata/apps_ts_tx_data07.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx07.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx07.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx01.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx01.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx02.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx02.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx03.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx03.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx04.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx04.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx05.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx05.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx06.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx06.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx08.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx08.dbf'; set newname for datafile '/u11d/oradata/PPOST/apps_ts_tx_idx09.dbf' to '/u06/orajall/oradata/apps_ts_tx_idx09.dbf'; set newname for datafile '/u16d/oradata/PPOST/ctxd01.dbf' to '/u06/orajall/oradata/ctxd01.dbf'; set newname for datafile '/u16d/oradata/PPOST/odm01.dbf' to '/u06/orajall/oradata/odm01.dbf'; set newname for datafile '/u16d/oradata/PPOST/olap01.dbf' to '/u06/orajall/oradata/olap01.dbf'; set newname for datafile '/u16d/oradata/PPOST/owapub01.dbf' to '/u06/orajall/oradata/owapub01.dbf'; set newname for datafile '/u16d/oradata/PPOST/portal01.dbf' to '/u06/orajall/oradata/portal01.dbf'; set newname for datafile '/u22d/oradata/PPOST/tools01.dbf' to '/u06/orajall/oradata/tools01.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data01.dbf' to '/u06/orajall/oradata/xxcu_data01.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data02.dbf' to '/u06/orajall/oradata/xxcu_data02.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data03.dbf' to '/u06/orajall/oradata/xxcu_data03.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data04.dbf' to '/u06/orajall/oradata/xxcu_data04.dbf';

set newname for datafile '/u15d/oradata/PPOST/xxcu_data05.dbf' to '/u06/orajall/oradata/xxcu_data05.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data06.dbf' to '/u06/orajall/oradata/xxcu_data06.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data07.dbf' to '/u06/orajall/oradata/xxcu_data07.dbf'; set newname for datafile '/u15d/oradata/PPOST/xxcu_data08.dbf' to '/u06/orajall/oradata/xxcu_data08.dbf'; set newname for datafile '/u18d/oradata/PPOST/xxcu_ind01.dbf' to '/u06/orajall/oradata/xxcu_ind01.dbf'; set newname for datafile '/u18d/oradata/PPOST/xxcu_ind02.dbf' to '/u06/orajall/oradata/xxcu_ind02.dbf'; set newname for datafile '/u14d/oradata/PPOST/xxad_data01.dbf' to '/u06/orajall/oradata/xxad_data01.dbf'; set newname for datafile '/u14d/oradata/PPOST/xxad_data02.dbf' to '/u06/orajall/oradata/xxad_data02.dbf'; set newname for datafile '/u14d/oradata/PPOST/xxad_data03.dbf' to '/u06/orajall/oradata/xxad_data03.dbf'; set newname for datafile '/u13d/oradata/PPOST/xxad_ind01.dbf' to '/u06/orajall/oradata/xxad_ind01.dbf'; set newname for datafile '/u13d/oradata/PPOST/xxad_ind02.dbf' to '/u06/orajall/oradata/xxad_ind02.dbf'; set newname for datafile '/u13d/oradata/PPOST/xxad_ind03.dbf' to '/u06/orajall/oradata/xxad_ind03.dbf'; set newname for datafile '/u13d/oradata/PPOST/xxad_ind04.dbf' to '/u06/orajall/oradata/xxad_ind04.dbf'; set newname for datafile '/u19d/oradata/PPOST/stage_data01.dbf' to '/u06/orajall/oradata/stage_data01.dbf'; set newname for datafile '/u19d/oradata/PPOST/stage_data02.dbf' to '/u06/orajall/oradata/stage_data02.dbf'; set newname for datafile '/u19d/oradata/PPOST/stage_data03.dbf' to '/u06/orajall/oradata/stage_data03.dbf'; set newname for datafile '/u19d/oradata/PPOST/stage_data04.dbf' to '/u06/orajall/oradata/stage_data04.dbf'; set newname for datafile '/u19d/oradata/PPOST/stage_data05.dbf' to '/u06/orajall/oradata/stage_data05.dbf'; set newname for datafile '/u19d/oradata/PPOST/stage_data06.dbf' to '/u06/orajall/oradata/stage_data06.dbf'; set newname for datafile '/u22d/oradata/PPOST/apps_ts_tool01.dbf' to '/u06/orajall/oradata/apps_ts_tool01.dbf'; set newname for datafile '/u22d/oradata/PPOST/qpa01.dbf' to '/u06/orajall/oradata/qpa01.dbf'; set newname for datafile '/u12d/oradata/PPOST/xxno_data01.dbf' to '/u06/orajall/oradata/xxno_data01.dbf'; set newname for datafile '/u09d/oradata/PPOST/xxno_index01.dbf' to '/u06/orajall/oradata/xxno_index01.dbf'; set newname for datafile '/u25d/oradata/PPOST/cdc_trg_tbs01.dbf' to '/u06/orajall/oradata/cdc_trg_tbs01.dbf'; duplicate target database to JALL

logfile '/u06/orajall/oradata/redo01.log' size 500m, '/u06/orajall/oradata/redo02.log' size 500m, '/u06/orajall/oradata/redo03.log' size 500m; } SQL to create the "set newname for datafile ...." sentences: set heading off set pagesize 999 select 'set newname for datafile ' || file_id || ' to ''/u06/orajall/oradata/' || substr(file_name,21,50) || ''';' from dba_data_files / 6. Create dup.sh rman catalogue rman/rman@rrman target netbackup/backupjalla123@pppost auxiliary / cmdfile dup.rcv log dup.log 7. Startup nomount 7.1. Run nohup ./dup.sh > /dev/null 2>&1 & -> wait for xx hours (may take 30 minutes). If we get the error: ORA-19870: error reading backup piece bk_3769_1_680473926 ORA-19507: failed to retrieve sequential file, handle="bk_3769_1_680473926", parms="" ORA-27029: skgfrtrv: sbtrestore returned error ORA-19511: Error received from media manager layer, error text: Backup file <bk_3769_1_680473926> not found in NetBackup catalogue Then perform this: !!!!!!The DBHOME content must either have the same owner (oracle) or the same group name as source DBHOME. In prod this is oracle and group oinstall.!!!!!!! For us it means that we have to: -Stop the JALL database (that is in nomount) -Register orajall into the group dba and set oinstall to main group (usermod -g oinstall -G dba orajall) -Change group id on DBHOME to oinstall. "chgrp -R oinstall DBHOME" -Log out and in -Start the base in nomount and try dup.sh once again

Duplicate has failed in the transition restore/recover because of EOF. Start base in nomount and run ./dup.sh once again. Duplicate continues from where it failed. If recover has started, you have to create a new rman script to do the recover only Check status using 'select status from v$instance'; if mount then double-check (!!) recover has finished successfully, then do a "alter database open resetlogs" BEFORE you proceed. 8. Check that DBID IS NOT similar to prod: PPOST (DBID=2167055306)

If it's the same, then increase open_cursors using "ALTER SYSTEM SET open_cursors = 400;" BEFORE proceeding To change dbid run: (Extracted from metalink note 224266.1) 1. Backup the database 2. SHUTDOWN IMMEDIATE of the database 3. STARTUP MOUNT 4. Open one session and run NID with sysdba privileges % nid TARGET=SYS/password # Forutsetter at SID er satt 5. Shutdown IMMEDIATE of the database 6. Set the DB_NAME initialization parameter in the initialization parameter file to the new database name 7. Create a new password file 8. Startup of the database with open reset logs If nid fails, it MAY will work to run it again after fixing the problem, please consult error list in this document: http://download.oracle.com/docs/cd/B10500_01/server.920/a96525/nidus.htm 9. Postklone stuff Switch back to original init file and restart the base. - remember to change controlfile suffix from .dbf to .ctl in the initJALL.ora file REMEMBER that COMPATIBLE parameter must be set to 10.2.0.2 in ifile.ora!!!!!!!!!!!!!!!!!! /u06/orajall/DBHOME/dbs/JALL_tebsdbd01_ifile.ora must contain compatible = 10.2.0.2 - fix the listener /u04/username/DBHOME/network/admin/listener.ora, replace all occurrences of PPOST with JALL - start the listener usink lsnrctl start JALL It looks like the post scripts fail if the group is changed to OINSTALL. OK if you change back to the DBA group... 9.0 Remember to add temp file to the TEMP tablespace (alter tablespace temp add tempfile '/PATH/temp01.dbf' size 3000M;) 9.1 Log out and in so that $ORACLE_HOME/JALL_tebsdbd01.env is sourced in. Evt just source in.... 9.2 cd <RDBMS ORACLE_HOME>/appsutil/install/<CONTEXT NAME> sqlplus "/ as sysdba" @adupdlib.sql <libext> where <libext> is "sl" for HP-UX, "so" for any other UNIX platform and not required for Windows. That is our example is: /u06/orajall/DBHOME/appsutil/install/JALL_tebsdbd01 sqlplus "/ as sysdba" @adupdlib.sql sl 9.3. cd <RDBMS ORACLE_HOME>/appsutil/clone/bin

perl adcfgclone.pl dbconfig <target context file> where target context file is: <RDBMS ORACLE_HOME>/appsutil/<Target CONTEXT_NAME>.xml

That in our example is: cd /u06/orajall/DBHOME/appsutil/clone/bin perl adcfgclone.pl dbconfig /u06/orajall/DBHOME/appsutil/JALL_tebsdbd01.xml

9.4. Create sp file and restart the base. FINISHED!!!!!!!!!!!!!! 10. Nope, still not finished; run "screen -x" to connect to screen again, then log out of the tunnels and screen by using exit-exit-exit until you are out