You are on page 1of 15

RMAN BACKUP AND RECOVERY SCENARIOS SCENARIO 2 SECTION (D) CLONE INSTANCE BY BACKUP BASED DUPLICATION

Assumption: (PRODUCTION instance is shutdown) ------------------------------------------------------------------------------------------------------------------------------Mount Point: /appquat Server IP / Hostname: 172.20.6.72 / polo.titan.co.in Oracle User: oraquat Oracle SID: QUALITY DB Port: 1526 ======================================================================== Step (1) Making relevant directories ======================================================================== Assuming directory structure already created on /appquat cd /appquat mkdir db apps cd db mkdir apps_st tech_st cd apps_st mkdir data ======================================================================= Step (2) Making script to copy the DB Home and Apps Home ======================================================================= cat appquat.sh echo `date` '- backup of db home and apps home from appprod to appquat started ...' >> /appquatlog cp -Rh /appprod/db/tech_st/* /appquat/db/tech_st/ cp -Rh /appprod/apps/* /appquat/apps/ echo `date` '- backup of db home and apps home from appprod to appquat completed ...' >> /appquatlog ======================================================================= Step (3) IMPLEMENTATION OF THE SCENARIO ======================================================================= Assuming the RMAN level 0 backup is in /bkprman and the directory /bkprman is owned by oraquat user ..

IMPLEMENTATION OF THE SCENARIO


Login as root 3.1) #slibclean #sync 3.2) root@polo:/ # su - oraquat oraquat:/home/oraquat>vi .profile

comment the apps environment file settings 3.3) Editing sqlnet.ora file in Network/admin cd /appquat/db/tech_st/11.2.0.3/network/admin/QUALITY_polo edit sqlnet.ora and comment the tcpip validate lines 3.4) Checking the Inventory Setting Ensure oraInst.loc , oraInventory , oratab under /etc are owned by oraquat ls -l oraInst.loc ls -l oraInventory ls -l oratab 3.5) Global Inventory Setting # pwd /etc cat oraInst.loc inst_group=dba inventory_loc=/etc/oraInventory 3.6) Local Inventory Setting DB Tier ls -l oraInst.loc ls -l oraInventory # cat oraInst.loc inst_group=dba inventory_loc=/appquat/db/tech_st/11.2.0.3/oraInventory 3.7) Ensuring jre Directory Please ensure that the JRE Directory should be present on /appquat/db/tech_st/11.2.0.3/appsutil folder ls l jre* 3.8) Exporting $ORACLE_HOME, Exporting PERL5LIB and NLSPATH cd /appquat/db/tech_st/11.2.0.3/appsutil/clone/bin export ORACLE_HOME=/appquat/db/tech_st/11.2.0.3 export PERL5LIB=$ORACLE_HOME/perl/lib/5.10.0:$ORACLE_HOME/perl/lib/site_perl/5.10.0:$ORAC LE_HOME/appsutil/perl ======================================================================= Step (4) Configuring the Database Tier Environment ======================================================================= 4.1) cd /appquat/db/tech_st/11.2.0.3/appsutil/clone/bin perl adcfgclone.pl dbTechStack

--------Put the Source System APPS password -----Log file located at /appquat/db/tech_st/11.2.0.3/appsutil/clone/bin/CloneContext_020154647.log Provide the values required for creation of the new Database Context file. Target System Hostname (virtual or normal) [arya] : polo Target Instance is RAC (y/n) [n] : n Target System Database SID : QUALITY Target System Base Directory : /appquat Target System utl_file_dir Directory List : /usr/tmp Number of DATA_TOP's on the Target System [1] : Press Enter Target System DATA_TOP Directory 1 [/appprod/db/apps_st/data] : /appquat/db/apps_st/data Target System RDBMS ORACLE_HOME Directory [/appquat/db/tech_st/11.1.0] : /appquat/db/tech_st/11.2.0.3 Do you want to preserve the Display [arya:0.0] (y/n) ? : n Target System Display [arya:0.0] : polo:0.0 Do you want the the target system to have the same port values as the source system (y/n) [y] ? :n Log file located at /appquat/db/tech_st/11.2.0.3/appsutil/log/QUALITY_polo/ApplyDBTechStack_02051551.log ---------------------------------------------------------------------------------------------------------------------------

Changing db_file_name_convert in Init.ora


4.2) Adding the parameters in initQUALITY.ora cd /appquat/db/tech_st/11.2.0.3/dbs vi initQUALITY.ora
db_file_name_convert=(/appprod/db/apps_st/data/,/appquat/db/apps_st/data/) log_file_name_convert=(/appprod/db/apps_st/data/,/appquat/db/apps_st/data/)

Changing ownership to oraquat to /bkprman folder 4.3) Changing the ownership of /bkprman to oraquat user . Chown Rh oraquat:dba /bkprman & 4.4) Keep only the latest controlfile backup piece on /bkprman/rman cd /bkrpman/rman $ ls -l *control*
-rw-r-----rw-r-----rw-r-----rw-r-----rw-r-----rw-r----1 oraquat dba 1 oraquat dba 1 oraquat dba 1 oraquat dba 1 oraquat dba 1 oraquat dba 34570240 Jul 16 10:20 RMAN_backup_control_c-183401397-20120715-00 34570240 Jul 16 10:20 RMAN_backup_control_c-183401397-20120715-01 34570240 Jul 16 10:20 RMAN_backup_control_c-183401397-20120715-02 34570240 Jul 16 10:20 RMAN_backup_control_c-183401397-20120715-03 34570240 Jul 16 10:20 RMAN_backup_control_c-183401397-20120715-04 34570240 Jul 15 08:01 RMAN_backup_control_c-183401397-20120715-05

Rest move it one step up .(keep only the latest as shown above , rest move it up . cd /bkprman/rman $ mv RMAN_backup_control_c-183401397-20120715-0[0-4] /home/oraquat/control/.

4.5) Source the env and start the db in nomount mode .. cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env $ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.3.0 Production on Mon Jul 16 10:29:57 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount ORACLE instance started. Total System Global Area 3206836224 bytes Fixed Size 2225776 bytes Variable Size 553650576 bytes Database Buffers 2634022912 bytes Redo Buffers 16936960 bytes SQL> exit 4.6) Creating a Password file .. cd /appquat/db/tech_st/11.2.0.3/dbs orapwd file=$ORACLE_HOME/dbs/orapwQUALITY password=SysquatAdmin entries=10 4.7) Creation of Server parameter file Cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env Sqlplus /as sysdba Sql> create spfile from pfile; Shutdown immediate SQL> startup nomount ORACLE instance started. Total System Global Area 3206836224 bytes Fixed Size 2225776 bytes Variable Size 553650576 bytes Database Buffers 2634022912 bytes

Redo Buffers SQL> exit

16936960 bytes

================================================================== cd /home/oraquat $ rman auxiliary / Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jul 16 10:28:51 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to auxiliary database (not started)

RMAN> duplicate database to "QUALITY" backup location '/bkprman/rman/';


=======================================================

contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Finished Duplicate Db at 16-JUL-12 RMAN> exit =====================================================================

Step (5) Commneting Parameters in initQUALITY.ora


5.1) Source the DB env and down the Database and Listener cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env cd /appquat/db/tech_st/11.2.0.3/appsutil/scripts/QUALITY_polo sh addlnctl.sh stop QUALITY sh addbctl.sh stop immediate (Stop the Listener ) (Stop the Database)

5.2) cd /appquat/db/tech_st/11.2.0.3/dbs vi initQUALITY.ora Comment the following in initQUALITY.ora

db_file_name_convert=(/appprod/db/apps_st/data/,/appquat/db/apps_st/data/) log_file_name_convert=(/appprod/db/apps_st/data/,/appquat/db/apps_st/data/)
5.3) Set the SGA and PGA size ,sessions, processes in InitQUALITY.ora as required =====================================================================

Step (6)
6.1) Source the DB env and start the Database and Listener cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env cd /appquat/db/tech_st/11.2.0.3/appsutil/scripts/QUALITY_polo

6.2) Clearing Old contents


cd $ORACLE_HOME/appsutil/scripts/RMAN_arya sh addbctl.sh start (Start the Database ) sh addlnctl.sh start RMAN (Start the DB Listener ) Login as Apps / Password ====(Source password) SQL>exec fnd_conc_clone.setup_clean; sh adautocfg.sh (Auto Config Database Tier)

Application side
# cat copyappl.sh echo `date` '- backup of apps appl from appprod to appquat started ...' >> /copyappllog cp -Rh /bkprman/apps/apps_st/appl/TJD_CUSTOM/* /appquat/apps/apps_st/appl/TJD_CUSTOM cp -Rh /bkprman/apps/apps_st/appl/au/* /appquat/apps/apps_st/appl/au echo `date` '- backup of apps appl from appprod to appquat completed ...' >> /copyappllog =====================================================================

Step (7) Post Clone for APPS Tier


7.1) cd /appquat/apps/apps_st/comn/clone/bin perl adcfgclone.pl appsTier (Source instance APPS Password to be given) During adcfgclone.pl Apps Tier, it will ask for prompt

PROMPT : Target System Hostname (virtual or normal) [polo] ANSWER : polo PROMPT : Target System Database SID ANSWER : QUALITY PROMPT : Target System Database Server Node [polo] ANSWER : polo PROMPT : Target System Database Domain Name [titan.co.in] ANSWER : titan.co.in PROMPT : Target System Base Directory ANSWER : /appquat Tools Oracle Home default value/appquat/apps/tech_st/10.1.2 PROMPT : Target System Tools ORACLE_HOME Directory [/appquat/apps/tech_st/10.1.2] ANSWER : Press Enter Web Oracle Home:/apppatch/apps/tech_st/10.1.3 PROMPT : Target System Web ORACLE_HOME Directory [/appquat/apps/tech_st/10.1.3] ANSWER : Press Enter Appl TOP:/appquat/apps/apps_st/appl PROMPT : Target System APPL_TOP Directory [/appquat/apps/apps_st/appl] ANSWER : Press Enter COMMON TOP:/appquat/apps/apps_st/comn PROMPT : Target System COMMON_TOP Directory [/appquat/apps/apps_st/comn] ANSWER : Press Enter PROMPT : Target System Instance Home Directory [/appquat/inst] ANSWER : Press Enter PROMPT : Target System Root Service [enabled] ANSWER : Press Enter PROMPT : Target System Web Entry Point Services [enabled] ANSWER : Press Enter PROMPT : Target System Web Application Services [enabled] ANSWER : Press Enter PROMPT : Target System Batch Processing Services [enabled] ANSWER : Press Enter PROMPT : Target System Other Services [disabled] ANSWER : Press Enter

PROMPT : Do you want to preserve the Display [arya:1.0] (y/n) ? ANSWER :n Display to be given : polo:1.0 Started testing the availability of ports in port pool 4 PROMPT : UTL_FILE_DIR on database tier consists of the following directories. 1. /usr/tmp 2. /usr/tmp 3. /appquat/db/tech_st/11.2.0.3/appsutil/outbound/QUALITY_polo 4. /usr/tmp Choose a value which will be set as APPLPTMP value on the target node [1] ANSWER :3

++++++++++( Checking the Outbound Directory location )++++++++++ cd /appquat/db/tech_st/11.2.0.3/appsutil/outbound/QUALITY_polo -----------------------------------------------------------------------------------------------------------------------------As per Note id : 725995.1 And the bug 5697740 the Apps Tier Post Cloning will hang at 3% Solution : Open one more Termial as root # ps -ef | grep opmn | grep oraquat Kill the Processes related to OPMN Services , until the Apps Tiers # kill -9 <PID of opmn -a -q ping> # kill -9 <PID of opmnctl stopall> The clone should continue now, in case it appears to hang again check if the opmn processes are started again and kill them until the clone continues. -----------------------------------------------------------------------------------------------------------------------------Apps tier services will get started asking the prompt for start Y/N Press N

Checking the Parameters in XML File


cd /appquat/apps/apps_st/appl . ./ APPSQUALITY_polo.env cd $INST_TOP/appl/admin ls l QUALITY_polo.xml

7.3) ++++++++++++DISPLAY+++++++++++++++ ls l QUALITY_polo.xml grep -i display QUALITY_polo.xml The Value of Display should be: <forms-c4ws_display oa_var="s_forms-c4ws_display" osd="unix">polo:0.0</forms<DISPLAY oa_var="s_display" osd="unix">polo:1.0</DISPLAY> 7.4) ++++++++++++TJD++++++++++++++++++ ls l QUALITY_polo.xml grep -i TJD QUALITY_polo.xml vi QUALITY_polo.xml Change the value tjd to TJD (Smaller Case to Bigger case on QUALITY_polo.xml file ) 7.5) ++++++++++TOP FILE CHANGES++++++++++ cd /appquat/apps/apps_st/appl/admin ls l topfile.txt vi topfile.txt Change the value tjd to TJD (Smaller Case to Bigger case on topfile.txt file ) 7.6) +++++++++REMOVAL OF SMALLER CASE tjd_custom directory +++++++++ cd /appquat/apps/apps_st/appl rm -rf tjd_custom (Accidently dont remove bigger case TJD_CUSTOM)

7.7) ++++++++++++LD PATH SETTING+++++++++++ cd /appquat/apps/tech_st/10.1.2/lib32 ls l ldflags* The Value of ldflag should point to Mount Point ldflags -> /appquat/apps/tech_st/10.1.2/lib/ldflags

If the Mount Point is not /appquat cd /appquat/apps/tech_st/10.1.2/lib32 rm rf ldlags 7.8) +++++++++++RECREATING SYMBOLIC LINK ++++++++++++ cd /appquat/apps/tech_st/10.1.2/lib ls l ls -l ldflags (here the ldflag value point to correct Mont Point )

ln -s $ORACLE_HOME/lib/ldflags $ORACLE_HOME/lib32/ldflags 7.9) ++++++++++++RELINKING FORM EXECUTABLES++++++++++++ cd $ORACLE_HOME/forms/lib32 pwd /appquat/apps/tech_st/10.1.2/forms/lib32 cd /appquat/apps/tech_st/10.1.2/forms/lib32 make -f ins_forms.mk install 7.10) ++++++++++UTL FILE PATH CHANGES+++++++++++++ cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env (Source the DB Tier Env )

cd $ORACLE_HOME/appsutil/scripts/QUALITY_polo sh addlnctl.sh stop QUALITY sh addbctl.sh stop immediate (Stop the Listener ) (Stop the Database)

pwd /appquat/db/tech_st/11.2.0/appsutil/scripts/QUALITY_polo exit 7.11) +++++++By root cross check any oraquat process is running or not+++++++++ Login as oraquat # su oraquat cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env cd $ORACLE_HOME/dbs ls l initQUALITY.ora (Source the DB Tier Env )

vi initQUALITY.ora Change the UTL Path : (NOTE SGA ,PGA ,SESSIONS,PROCESS should be checked ) =====================================================================

Step (8) UTL File, Custom ENV File Changes and Password Changes
8.1) UTL File path in initQUALITY.ora utl_file_dir = /appquat/db/tech_st/11.2.0.3/appsutil/outbound/QUALITY_polo,/usr/tmp cd $ORACLE_HOME/appsutil/scripts/QUALITY_polo sh addbctl.sh start sh addlnctl.sh start QUALITY sh adautocfg.sh (Start the Database ) (Start the DB Listener ) (Auto Config Database Tier)

8.2) ++++++++++++Password Changes for SYS,SYSTEM,DBSNMP User++++++++++ cd /appquat/db/tech_st/11.2.0.3 . ./QUALITY_polo.env sqlplus /as sysdba SQL> alter user sys identified by SysquatAdmin; SQL> alter user system identified by SystemquatAdmin; SQL> alter user dbsnmp identified by dbsnmp; (Source the DB Tier Env )

8.4) ++++++++++++CREATION OF CUSTOM ENVIROMENTAL FILE +++++++++++ cd /appquat/apps/apps_st/appl . ./APPSQUALITY_polo.env Put the Command as follows: pwd /appquat/apps/apps_st/appl echo "TJD_CUSTOM_TOP=/appquat/apps/apps_st/appl/TJD_CUSTOM/12.0.0" customQUALITY_polo.env echo "export TJD_CUSTOM_TOP " >> customQUALITY_polo.env >

. ./APPSQUALITY_polo.env cd $ADMIN_SCRIPTS_HOME $ pwd /appquat/inst/apps/QUALITY_polo/admin/scripts $ sh adautocfg.sh 8.5) ++++++++++++++++++++Apps password Changes +++++++++++++++++++ cd /appquat/apps/apps_st/appl . ./APPSQUALITY_polo.env
FNDCPASS apps/Apps750Live 0 Y system/SystemquatAdmin SYSTEM APPLSYS AppsquatLive

Source System Password / Production Apps Password

System Password of QUALITY or Target Instance

Apps Password to be given for QUALITY

8.6) ++++++++++++++++++Changes on TJD_CUSTOM_TOP/bin+++++++++++++++++ cd $TJD_CUSTOM_TOP/bin pwd /appquat/apps/apps_st/appl/TJD_CUSTOM/12.0.0/bin ls l TNQ_PO_INTERFACE_OUTRIGHT_SCRIPT vi TNQ_PO_INTERFACE_OUTRIGHT_SCRIPT Change the Apps Password specific to QUALITY

8.7) ++++++++++++FND REQUEST CLEARING+++++++++++++++ In toad as a apps user select * from v$instance ; select * from FND_CONCURRENT_REQUESTS

where STATUS_CODE='I' and PHASE_CODE='P'; Be Careful to ensure that INSTANCE IS QUALITY, Before Truncating the Table Truncate the TABLE FND_CONCURRENT_REQUESTS 8.8) +++++++++++++++++++STARTING THE APPLICATION++++++++++++++ cd /appquat/apps/apps_st/appl $ . ./APPSQUALITY_polo.env cd /home/oraquat $ sqlplus apps/AppsquatLive SQL> @cmclean.sql Enter dual And commit cd $ADMIN_SCRIPTS_HOME pwd /appquat/inst/apps/QUALITY_polo/admin/scripts $ sh adstrtal.sh apps/AppsquatLive 8.9) +++++++++++++++++++XMLTEMP PATH SETTING++++++++++++++ Login as http://polo.titan.co.in:8004

Go to XML Publisher Administrator - > Administration Click on Administration -> General =====Temporary directory : /appprod/db/tech_st/XMLPTEMP =====

Change the Value of Temporary Directory as : Temporary directory: Save and Log out /appquat/db/tech_st/XMLPTEMP

8.10) ++++++++++++++++++++Site Name Changes +++++++++++++++++++

Login as

http://polo.titan.co.in:8005/forms/frmservlet

Change the Site Name from PROD to QUALITY from Sys Admin Responsibility =====================================================================

Step (9) Final Steps


9.1) cd /home/oraquat Cross check the any of following files are already there or not , if there remove it touch dbenv appsenv dbstart.sh dbstop.sh appsstart.sh appsstop.sh chmod 755 dbenv dbstart.sh dbstop.sh appsenv appsstart.sh appsstop.sh cd /appquat/db/tech_st/11.2.0.3 ls l QUALITY_polo.env cat QUALITY_polo.env >> /home/oraquat/dbenv cd /appquat/apps/apps_st/appl ls l APPSQUALITY_polo.env cat APPSQUALITY_polo.env >> /home/oraquat/appsenv 9.2) Creation of Start and Shut down Scripts cd /home/oraquat Put the values on dbstart.sh vi dbstart.sh sh /appquat/db/tech_st/11.2.0.3/appsutil/scripts/QUALITY_polo/addbctl.sh start sh /appquat/db/tech_st/11.2.0.3/appsutil/scripts/QUALITY_polo/addlnctl.sh start QUALITY

Put the values on dbstop.sh vi dbstop.sh sh /appquat/db/tech_st/11.2.0.3/appsutil/scripts/QUALITY_polo/addlnctl.sh stop QUALITY sh /appquat/db/tech_st/11.2.0.3/appsutil/scripts/QUALITY_polo/addbctl.sh stop immediate Put the values on appsstart.sh

vi appsstart.sh sh /appquat/inst/apps/QUALITY_polo/admin/scripts/adstrtal.sh apps/AppsquatLive Put the values on appsstop.sh vi appstop.sh sh /appquat/inst/apps/QUALITY_polo/admin/scripts/adstpall.sh apps/AppsquatLive 9.3) modifying .profile Changes on .profile /home/oraquat vi .profile customfile=/appquat/apps/apps_st/appl/customQUALITY_polo.env if [ -f $customfile ]; then . /appquat/apps/apps_st/appl/customQUALITY_polo.env fi . /appquat/inst/apps/QUALITY_polo/ora/10.1.2/QUALITY_polo.env . /appquat/apps/apps_st/appl/QUALITY_polo.env =====================================================================

You might also like