Monday 17 March 2014

Oracle Applications Cloning

Oracle Applications Cloning

àWhat is Cloning

Cloning is creating an identical copy of an existing Oracle E-Business Suite system. The system to be cloned is referred to as the source system, and the newly created system is referred to as the target system.

àWhy do we need to clone

We should not do any changes directly on production databases (Ex:- Patching). First we have to test those changes on non-production databases (Stress, Dev, Test, UAT, Prod), if the changes we made were successful on non-prod databases then we can perform the same activities on production database. For this we should have some other database which should be identical in data as of production database. Therefore, we clone from production to non-production databases.

àFrequency of cloning

Frequency of cloning depends up on customer requirement. In general, for every one week or for once in 10 days we will do clone from production to non-production databases.

àAdvantages of cloning

ü  Creating a copy of a production system for patch testing
ü  Creating a staging area to reduce the downtime required for patching
ü  Refreshing a test system from a production system
ü  Moving an existing system to a different machine or platform
ü  cloning is used to add a node to an existing installation

àCloning tools and related information

ü  Rapid Clone is a tool using which  we will clone Oracle Applications
ü  Rapid Clone was introduced from oracle applications version 11.5.8 onwards
ü  Rapid Clone completely  supports Cold Backup
ü  Rapid clone does not support hot backup and RMAN backup cloning completely, It supports only partially.s
ü  If we use  Rapid Clone to add a node, a new row is inserted into FND_NODES, whereas when creating a new installation, FND_NODES is purged and a completely new set of rows inserted
ü   If your environment is Autoconfig enabled then you can confirm that rapid clone is enabled

àCloning options

Rapid clone supports different options for cloning :-

ü  Single node to Single node
ü  Multi-node to Multi-node
ü  Single node to Multi-node
ü  Multi-node to Single node

   
àCloning across platforms

ü  Most of the times cloning takes place between same operating system versions with same binary compatible. (Ex 32 bit to 32 bit).
ü  Rapid clone also supports cloning between different  bit versions of same operating system(Ex: 32 bit to 64 bit)
ü  Rapid Clone also supports if  the source system is running an earlier version of the same operating system that is being used on the target system
ü  Rapid Clone does not support  cloning  from a highest  version of an operating system to an lowest one

àHigh level steps for cloning

ü  Perform Pre  Health Checks
ü  Prepare Source System
Ø  Prepare Database Tier by running adpreclone.pl
Ø  Prepare Application Tier by running adpreclone.pl
ü  Copy Source System to Target System
Ø  Copy APPL_TOP,COMMON_TOP,INST_TOP,10.1.2 and 10.1.3 ORACLE_HOMES
Ø  Copy RDBMS_ORACLE_HOME and CRD files to target system
Note:-In case of cold backup we need to shut down and copy, In case of Hot backup                                       keep database in begin backup mode and copy.
ü  Prepare Target  System
Ø  Configure Database Tier by running adcfgclone.pl
Ø  Configure Application Tier by running adcfgclone.pl
ü  Perform Post Health Checks in Target System

àWhat is adpreclone.pl

When we run adpreclone.pl in database tier, It will collect all information about database tier and perform below actions.

ü  Creates staged cloned area at $ORACLE_HOME/appsutil/clone
ü  Creates template files at $ORACLE_HOME/appsutil/template
ü  Creates driver files at  $ORACLE_HOME/appsutil/drivers
ü  Converts inventory from binary to xml
ü  Create database control file script
ü  Generates database creation driver file
ü  Copy JDBC Libraries

When we run adpreclone.pl in application tier, It will collect  all information about application tier and perform below actions

ü  Create stage cloned area at $COMMON_TOP/clone
ü  It will create template files and driver files for 10.1.2  ORACLE_HOME
ü  It will create template files and driver files for 10.1.3   ORACLE_HOME
ü  Copy JDBC libraries
ü  In addition, there are a number of associated actions relating to the database.

Note:- We can run the preclone script when applications are up and running and also  in down time, It will not modify any files under db and applications . It only collects the information from db and application and we can run preclone script in any priority on db and apps.

àWhat is adcfgclone.pl

ü  This script will perform the clone configuration in the target machine.
ü  During this configuration phase adcfgclone will reconfigure the copied instance after gathering the required information.
ü  First run this script on database tier only, then after successful completion, run this script on application tier.
ü  When we run adcfgclone.pl script it will ask for some questions , based on the answers given to this script it will configure target system by  performing  below actions in db tier and application tier.

On Database Tier :-

ü  Creates the Database context file
ü  Registers the ORACLE_HOME in the Global Inventory
ü  Relinks  the ORACLE_HOME
ü  Configures the ORACLE_HOME
ü  Recreates the database control files
ü  Starts the database
ü  Configures the database
ü  Starts the database listener

On Applications Tier :-

ü  Creates the Applications context file
ü  Registers the OracleAS 10.1.2 and OracleAS 10.1.3 ORACLE_HOMEs in the Global Inventory
ü  Relinks the OracleAS ORACLE_HOMEs
ü  Configures the OracleAS ORACLE_HOMEs
ü  Configures the APPL_TOP
ü  Creates the INST_TOP by running Autoconfig
ü  Starts application tier server processes

àVarious Methods for cloning

1) Cold cloning
 2) Hot Cloning
 3) Rman cloning

1) COLD CLONING

SOURCE MACHINE:-                                                            TARGET  MACHINE:-

Hostname:-fed01.redshoretech.com                              Hostname:-fed03.redshoretech.com
DB_NAME: PSHORE                                                             DB_NAME: PSHORE
ORACLE_SID: PSHORE                                                         ORACLE_SID: PSHORE
PORT POOL:-20                                                                    PORT POOL:-40


Perform below steps on source machine.

Step 1:- Verify OS requirements on target system

ü  Before cloning to a new server, ensure the target system meets all the requirements for Oracle Applications.
ü  Verify source and target system software components and versions
In addition to the Oracle Applications software requirements, the following software component versions must exist on the source or target nodes as applicable. The 'Location' column indicates the node where the software component must reside.

Note:- If any component version is not satisfying the minimum required versions then upgrade the component and then continue with other steps.

Software Component
Minimum Version
Required Location
                            Comments
Zip
2.3 (or higher)
All source system nodes
Download from Info Zip. Zip must be in your $PATH. If using files bigger than 2Gb, you should use Info Zip 3.0 or higher.
Unzip
5.52 (or higher)
All source system nodes
Download from Info Zip. Unzip must be in your $PATH. If using files bigger than 2Gb, you should use Info Zip UNZIP 5.52 or higher.
Operating System Utilities
N/A
All target system nodes
The required operating system utilities for your platform must be in your $PATH when running adcfgclone.pl. For example, make, ld, and ar on UNIX. 
Perl
5.x
All target system nodes
Uses the Perl shipped with OracleAS 10.1.3 and Database 10g, or download it from Perl.com. Perl must be in your $PATH, and $PERL5LIB must be set correctly before cloning.

Apply the latest Rapid Clone patches

We need to apply the following patches on the source instance (For Release 12.1) before performing cloning.

2. 9171651
3. 9833058
4. 12404574
5. 12598630

ü  Above patches include AD patch, Autoconfig Patches and Rapid Clone Patches
ü  When we apply AD patch it will bring latest maintenance tools and utilities to oracle applications which will enhance the performance of rapid clone.
ü  After applying all the above patches, update current view snapshot for the complete APPL_TOP.

Perform the below steps in Target Machine:-

Step 1:-Check for the required rpm’s, kernel parameters and open file descriptors required for R12.1 (Follow R12.1 Installation document). As cloning is the identical copy of existing oracle applications , the target machine also requires all configurations and requirements  which we performed while installing applications in source machine.

Create required group, users and the directories to clone.

# groupadd clone
# useradd -g clone  -d  /u01/applmgr  applmgr
# useradd -g clone   -d  /u02/oracle  oracle
# chmod –R  777 /u01/applmgr
# chmod   -R  777 /u02/oracle
# su – oracle
$ mkdir –p /u02/oracle/db
# su – applmgr
$ mkdir –p /u01/applmgr/apps/apps_st
$ mkdir –p /u01/applmgr/apps/tech_st

Step 2:- Prepare the Source system for cloning

2. (a) Run preclone on DB Tier

Login to database user from putty.
$ cd $ORACLE_HOME/appsutil/scripts
$ perl adpreclone.pl dbTier

ü  This will create staging area in $ORACLE_HOME/appsutil/clone

2. (b) Run preclone on Apps Tier

Login to application user from putty.
$ cd $INST_TOP/admin/scripts
$ perl adpreclone.pl appsTier

ü  This will create staging area in $COMMON_TOP/clone
ü  We can perform these pre-clone steps parallel or we can first run pre-clone on database tier and then on application tier and vice-versa.
ü  The above two scripts does not modify anything in database tier and application tier, they will only collect information about database tier and application tier. So, while running these scripts no need to shut down database and application tier.

Step 3:- Copy source instance file system to destination file system.

Note: Ensure that database and applications were down.

3. (a) Copy source system application file system to destination system

$ scp –r inst applmgr@192.168.3.16:/u01/applmgr
$ cd   /u01/applmgr/apps/apps_st
$ scp –r appl applmgr@192.168.3.16: /u01/applmgr/apps/apps_st
$ scp –r comn applmgr@192.168.3.16: /u01/applmgr/apps/apps_st
$ cd   /u01/applmgr/apps/tech_st
$ scp  –r  10.1.2 applmgr@192.168.3.16: /u01/applmgr/apps/tech_st
$ scp   –r  10.1.3 applmgr@192.168.3.16: /u01/applmgr/apps/tech_st

3. (b) Copy source system database file system to destination system

$ cd   /u02/oracle/db
$ scp –r apps_st oracle@192.168.3.16:/u02/oracle/db
$ scp –r tech_st oracle@192.168.3.16:/u02/oracle/db

Once we finished copying source file system to target machine, then we can start database and application services.

Step 4:-Configuring destination server

On destination server first we need to configure database and then configure applications.

4. (a) Configure database tier

$ cd db/tech_st/11.1.0/appsutil/clone/bin
$ perl adcfgclone.pl dbTier

This script will ask the following questions.

Target System Hostname (virtual or normal) [fed03] : fed03
Target Instance is RAC (y/n) [n] : n
Target System Database SID : RSHORE
Target System Base Directory : /u02/oracle
Target System utl_file_dir Directory List : /tmp
Number of DATA_TOP's on the Target System [1] : 1
Target System DATA_TOP Directory 1 [/u02/oracle/db/apps_st/data] : /u02/oracle/db/apps_st/data
Target System RDBMS ORACLE_HOME Directory [/u02/oracle/db/tech_st/11.1.0] : /u02/oracle/db/tech_st/11.1.0
Do you want to preserve the Display [fed03.redshoretech.com :0.0] (y/n) : n
Target System Display [fed01:0.0] fed03.redshoretech.com:0.0
Do you want the target system to have the same port values as the source system (y/n) [y] ? : n
Target System Port Pool [0-99]: 18

Based on the answers, it will

ü  Build new <Context name>.xml file
ü  Clone Oracle home
ü  Brings database to no mount state
ü  Recreate control file
ü  Bring database to mount state
ü  Perform recovery
ü  Bring up the database to open state
ü  Runs Autoconfig on db tier
ü  Registers Oracle home in central inventory
ü  Starts the database and listener.

4. (b) Configure Application tier

$ cd $COMMON_TOP/clone/bin
$ perl adcfgclone.pl appsTier

This script will ask the following questions.

Target System Hostname (virtual or normal) [fed03] : fed03
Target System Database SID: RSHORE
Target System Database Server Node [fed03]: fed03
Target System Database Domain Name [redshoretech.com]: redshoretech.com
Target System Base Directory: /u01/applmgr
Target System Tools ORACLE_HOME Directory [/u01/applmgr/apps/tech_st/10.1.2]: /u01/applmgr/apps/tech_st/10.1.2
Target System Web ORACLE_HOME Directory [/u01/applmgr/apps/tech_st/10.1.3]: /u01/applmgr/apps/tech_st/10.1.3
Target System APPL_TOP Directory [/u01/applmgr/apps/apps_st/appl]: /u01/applmgr/apps/apps_st/appl
Target System COMMON_TOP Directory [/u01/applmgr/apps/apps_st/comn]: /u01/applmgr/apps/apps_st/comn
Target System Instance Home Directory [/u01/applmgr/inst]: /u01/applmgr/inst
Target System Root Service [enabled]: enabled
Target System Web Entry Point Services [enabled]: enabled
Target System Web Application Services [enabled]: enabled
Target System Batch Processing Services [enabled]: enabled
Target System Other Services [disabled]: enabled
Do you want to preserve the Display [vmrshoret3fusiondb:0.0] (y/n): n
Target System Display [fed03:0.0]: fed03:0.0
Do you want the target system to have the same port values as the source system (y/n) [y]? : n
Target System Port Pool [0-99]: 18

Based on the answers the above script will

ü  Build new .xml file
ü  Clone 10.1.2 and 10.1.3 Oracle Homes
ü  Runs Autoconfig
ü  Starts all the application services.


2) HOT CLONING

For Step 1 and Step 2 perform same steps as mentioned in cold cloning.

Step 3:- Copy source instance file system to destination file system.

3. (a) Copy source system application file system to destination system

$ scp –r inst applmgr@192.168.3.16:/u01/applmgr
$ cd   /u01/applmgr/apps/apps_st
$ scp –r appl applmgr@192.168.3.16: /u01/applmgr/apps/apps_st
$ scp –r comn applmgr@192.168.3.16: /u01/applmgr/apps/apps_st
$ cd   /u01/applmgr/apps/tech_st
$ scp  –r  10.1.2 applmgr@192.168.3.16: /u01/applmgr/apps/tech_st
$ scp   –r  10.1.3 applmgr@192.168.3.16: /u01/applmgr/apps/tech_st

3. (b) Copy source system database file system to destination system
   
     (1) Take the archive log sequence number.
     SQL> archive log list

     (2) Keep the database in begin backup mode.
     SQL> alter database begin backup;

     (3) Copy datafiles to target server.
     $ cd /u02/oracle/db/apps_st/data
     $ scp *.dbf oracle@192.168.3.16: /u02/oracle/db/apps_st/data

     (4) Keep the database in end backup mode.
     SQL> alter database end backup;

     (5) Perform log switch.
     SQL> alter system switch logfile;

     (6) Take ASCII format controlfile backup.
     SQL> alter  database backup controlfile to /tmp/control.ctl;
     Modify the ASCII format controlfile as per the target system specifications.    

     (7) Copy ASCII format controlfile to the target server.
     $ scp /tmp/control.ctl oracle@192.168.3.16:/u02/oracle/db/apps_st/data/cntrl01.dbf
     $ scp /tmp/control.ctl oracle@192.168.3.16:/u02/oracle/db/apps_st/data/cntrl02.dbf
  
     (8) Copy generated archivelogs to target server.

     (9) Copy Oracle Home to target machine
     $ /u02/oracle/db/tech_st    
     $ scp –r  11.1.0 oracle@192.168.3.16: /u02/oracle/db/tech_st

Step 4 :- Configuring destination server

On destination server first we need to configure database and then configure applications.

4. (a) Configure database tier

(1)$ cd db/tech_st/11.1.0/appsutil/clone/bin
     $ perl adcfgclone.pl dbTechStack

This script will ask the following questions.

Target System Hostname (virtual or normal) [fed03] : fed03
Target Instance is RAC (y/n) [n] : n
Target System Database SID : RSHORE
Target System Base Directory : /u02/oracle
Target System utl_file_dir Directory List : /tmp
Number of DATA_TOP's on the Target System [1] : 1
Target System DATA_TOP Directory 1 [/u02/oracle/db/apps_st/data] : /u02/oracle/db/apps_st/data
Target System RDBMS ORACLE_HOME Directory [/u02/oracle/db/tech_st/11.1.0] : /u02/oracle/db/tech_st/11.1.0
Do you want to preserve the Display [fed03:0.0] (y/n) : n
Target System Display [fed03:0.0] :  fed03:0.0
Do you want the target system to have the same port values as the source system (y/n) [y] ? : n
Target System Port Pool [0-99]: 18

(1)This will build new <context_name>.xml and clone Oracle home.
(2) Startup database in no mount state.
(3) Recreate Controlfile by using modified trace file.
(4) Perform Recovery.
(5) Open the database with reset logs option.
(6)  $ cd db/tech_st/11.1.0/appsutil/clone/bin
       $ perl adcfgclone.pl dbconfig  <Path of XML file>

Note: Before running this script, make sure that database and listener are up and running.

The above script will run Autoconfig and registers Oracle home with OraInventory.

4. (b) Configure Application tier

$ cd $COMMON_TOP/clone/bin
$ perl adcfgclone.pl appsTier

This script will ask the following questions.

Target System Hostname (virtual or normal) [fed03] : fed03
Target System Database SID: RSHORE
Target System Database Server Node [fed03]: fed03
Target System Database Domain Name [redshoretech.com]: redshoretech.com
Target System Base Directory: /u01/applmgr
Target System Tools ORACLE_HOME Directory [/u01/applmgr/apps/tech_st/10.1.2]: /u01/applmgr/apps/tech_st/10.1.2
Target System Web ORACLE_HOME Directory [/u01/applmgr/apps/tech_st/10.1.3]: /u01/applmgr/apps/tech_st/10.1.3
Target System APPL_TOP Directory [/u01/applmgr/apps/apps_st/appl]: /u01/applmgr/apps/apps_st/appl
Target System COMMON_TOP Directory [/u01/applmgr/apps/apps_st/comn]: /u01/applmgr/apps/apps_st/comn
Target System Instance Home Directory [/u01/applmgr/inst]: /u01/applmgr/inst
Target System Root Service [enabled]: enabled
Target System Web Entry Point Services [enabled]: enabled
Target System Web Application Services [enabled]: enabled
Target System Batch Processing Services [enabled]: enabled
Target System Other Services [disabled]: enabled
Do you want to preserve the Display [vmrshoret3fusiondb:0.0] (y/n): n
Target System Display [fed03:0.0]: fed03:0.0
Do you want the target system to have the same port values as the source system (y/n) [y]? : n
Target System Port Pool [0-99]: 18

The above script will

1. Build new .xml file
2. Clone 10.1.2 and 10.1.3 Oracle Homes
3. Runs Autoconfig
4. Starts all the application services.

3) RMAN Cloning using Active Duplicate Method

For Step 1 and Step 2 perform same steps as mentioned in cold cloning.
                     
Step 3:- Copy source instance file system to destination file system.

3. (a) Copy source system application file system to destination system

$ scp –r inst applmgr@192.168.3.16:/u01/applmgr
$ cd /u01/applmgr/apps/apps_st
$ scp –r appl applmgr@192.168.3.16: /u01/applmgr/apps/apps_st
$ scp –r comn applmgr@192.168.3.16: /u01/applmgr/apps/apps_st
$ cd /u01/applmgr/apps/tech_st
$ scp  –r  10.1.2 applmgr@192.168.3.16: /u01/applmgr/apps/tech_st
$ scp   –r  10.1.3 applmgr@192.168.3.16: /u01/applmgr/apps/tech_st

3. (b) Copy source system database file system to destination system   

Copy only tech_st  from source machine to target machine

scp -r  tech_st oracle@192.168.3.16:/u02/oracle/db

Step 4:- 4.(a) Configure database tier

(1) cd db/tech_st/11.1.0/appsutil/clone/bin

$ perl adcfgclone.pl dbTechStack

This will only clone oracle home not the entire database.

This script will ask the following questions

Target System Hostname (virtual or normal) [fed03] : fed03
Target Instance is RAC (y/n) [n] : n
Target System Database SID : RSHORE
Target System Base Directory : /u02/oracle
Target System utl_file_dir Directory List : /tmp
Number of DATA_TOP's on the Target System [1] : 1
Target System DATA_TOP Directory 1 [/u02/oracle/db/apps_st/data] : /u02/oracle/db/apps_st/data
Target System RDBMS ORACLE_HOME Directory [/u02/oracle/db/tech_st/11.1.0] : /u02/oracle/db/tech_st/11.1.0
Do you want to preserve the Display [vmrshoret3fusiondb:0.0] (y/n) : n
Target System Display [fed03:0.0] :  fed03:0.0
Do you want the target system to have the same port values as the source system (y/n) [y] ? : n
Target System Port Pool [0-99]: 18


(2) Configure Networking between source and target instances.

Configure Listener on source machine.
Configure tns on source machine to connect to target machine.
Configure listener on target machine.
Configure tns on target machine to connect to source machine and one more tns to connect to itself.

(3) Perform  RMAN Active duplication.

Start the target database in nomount state.

[oracle@fed03 ~]$ rman  target sys/sys@to_source auxiliary sys/sys@to_target

Recovery Manager: Release 11.1.0.7.0 - Production on Mon Mar 11 18:59:03 2013
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: REDSHORE (DBID=1475563812)
connected to auxiliary database: RSHORE (not mounted)

RMAN> duplicate target database to ‘RSHORE’ from active database;

Finished Duplicate Db at 12-MAR-13

RMAN> exit
Recovery Manager complete.

(4) Run adcfgclone.pl with argument dbconfig

$ cd db/tech_st/11.1.0/appsutil/clone/bin
$ perl adcfclone.pl dbconfig

The above script runs Autoconfig and registers Oracle Home in OraInventory.

4.(b)  Configure Application tier

$ cd $COMMON_TOP/clone/bin
$ perl adcfgclone.pl appsTier

This script will ask the following questions.

Target System Hostname (virtual or normal) [fed03] : fed03
Target System Database SID: RSHORE
Target System Database Server Node [fed03]: fed03
Target System Database Domain Name [redshoretech.com]: redshoretech.com
Target System Base Directory: /u01/applmgr
Target System Tools ORACLE_HOME Directory [/u01/applmgr/apps/tech_st/10.1.2]: /u01/applmgr/apps/tech_st/10.1.2
Target System Web ORACLE_HOME Directory [/u01/applmgr/apps/tech_st/10.1.3]: /u01/applmgr/apps/tech_st/10.1.3
Target System APPL_TOP Directory [/u01/applmgr/apps/apps_st/appl]: /u01/applmgr/apps/apps_st/appl
Target System COMMON_TOP Directory [/u01/applmgr/apps/apps_st/comn]: /u01/applmgr/apps/apps_st/comn
Target System Instance Home Directory [/u01/applmgr/inst]: /u01/applmgr/inst
Target System Root Service [enabled]: enabled
Target System Web Entry Point Services [enabled]: enabled
Target System Web Application Services [enabled]: enabled
Target System Batch Processing Services [enabled]: enabled
Target System Other Services [disabled]: enabled
Do you want to preserve the Display [vmrshoret3fusiondb:0.0] (y/n): n
Target System Display [fed03:0.0]: fed03:0.0
Do you want the target system to have the same port values as the source system (y/n) [y]? : n
Target System Port Pool [0-99]: 18

The above script will

1. Build new .xml file
2. Clone 10.1.2 and 10.1.3 Oracle Homes
3. Runs Autoconfig
4. Starts all the application services.