Wednesday 19 February 2014

ORACLE APPLICATION CLONING METHODS :
******************************************

Hello all, As per the request and with experience I am again returing to Cloning of Oracle Application. I know most of them know what exactly happens in cloning but still here I am trying to touch the depths.

Before starting I want to ask question. Why you need to do cloning ? Why we need to duplicate Oracle Application.

We need cloning for various of reasons. suppose I have got production instance and want to test some application. Now here I want to test the application, need to apply some product specific patches which might affect whole application then I have to give downtime which will affect business. So if I had the same this on whic hI can play and test my application or code or say I can apply some patches and at the same time business also run then nothing like it. This can be achieved by cloning or duplicating the application.

Duplicating the application is not easy or its just not simply copy the application, it wont work in any case. Logically it sounds fine just to copy the filesystem and relink it and start the application but its not that easy.

Basically for cloning Oracle Application it can be categorised into three major categories.

-Preparing the Source System
-Copy the file System
-Preparing or say Configuring the Target System

You can achive first and third steps using a Rapid Clone utility which Oracle provides for cloning

There can be many ways and methods to clone Oracle Application which many organisations follows but the only supported method provided by Oracle is using Rapid clone.

Rapid Clone is the new cloning utility introduced in Release 11.5.8. Rapid Clone leverages the new installation and configuration technology utilized by Rapid Install.

Basically there are two cloning methodology using Autoconfig and without using autoconfig. First one that is using autoconfig is completely replaced by Rapidclone.

Non-autocofig cloning methodology was generally used before 11.5.5 that is non autoconfig enabled system.

Here I will discuss Rapid Clone method of cloning and also throw some light on cloning 11.0.3 oracle application as some users are still using that.

So first about the Rapid clone method.

In Category 1 that is first you need to make source for clone. You need to dress up Source system so that only configuration files and not the whole file system is copied.

Pre-requiste Steps

To start with cloning you need to first check about some pre-requisites some utilities should be of required version

Here are they,

Oracle Universal Installer should be of 2.2.0.19 version
Perl should be of 5.005 version minimum
JRE 1.1.8 and 1.3.1
JDK 1.3.1
Zip utility of version 2.3 minimum
Latest Autoconfig Templates patches are applied. TXK-O is the latest till date.
Latest Rapid Clone patches should be applied. Latest is ADX.F till date.

After check ing the pre-requisites now your system is ready to clone.

Preparing the Source system:

After checking the above mentioned pre-requisites now you have to prepare the source system which need to be cloned.

In a broad way what this step will do is this will create the staged clone directory which will be having the driver files and configuration file of the source.

So what exactly is going to happen in this step. Lets get in more details

Basically you have to run the adpreclone.pl script once for Application tier and one for the datbase (even if you are on single node ! )

Lets first check for the Database tier

On Source system, run following as ORACLE user

cd RDBMS Oracle_Home/appsutil/scripts/_perl ./adpreclone.pl dbTier

After running this it goes in two stages

dbTechstack and Database

What exactly it will do is
It will create stage cloned area at $ORACLE_HOME/appsutil/clone This clone directory has got following main directories
data,jre,bin,db,html,context

It will prepare datbase techstack at dbTechStack stage. Major activities it will take care of at this stage.

-Creates template files at $ORACLE_HOME/appsutil/template
-Creates driver files at $ORACLE_HOME/appsutil/driver/instconf.drv
-Converts inventory from binary to xml

It will prepare datbase at the database stage. Major activities includes

-Create datbase control file script
$Oracle_Home/appsutil/clone/context/data/stage/addbhomsrc.xml
$Oracle_Home/appsutil/clone/context/data/stage/adcrdb.zip
adcrdbclone.sql

-Generates database creation driver file
$Oracle_Home/appsutil/clone/context/data/driver/data.drv

-Copy JDBC Libraries
$Oracle_Home/appsutil/clone /clone/jlib/classes111.zip

So all this happens on database side

Now lets concentrate on Application tier side. Again it goes almost in the same way that is in two stages.

As a APPLMGR user on application tier this script is run
cd $COMMON_TOP/admin/scripts/_perl ./adpreclone.pl appsTier

It will also create the staged clone directory at $COMMON_TOP/clone
It goes in two stages. Lets see one by one

atTechStack that is Application tier techstack.

- Creates template files for
Oracle_iAS_Home/appsutil/template
Oracle_806_Home/appsutil/template

-Creates Techstack driver files for
Oracle_iAS_Home/appsutil/driver/instconf.drv
Oracle_806_Home/appsutil/driver/instconf.drv

appltop preparation

-It will create application top driver file
$COMMON_TOP/clone/appl/driver/appl.drv

-Copy JDBC libraries
$COMMON_TOP/clone/jlib/classes111.zip

So this all happens in dressing the source system

After then we need to copy the files.

Copy following files

APPL_TOP
OA_HTML ($COMMON_TOP/html)
JAVA_TOP
COMMON_TOP/util
COMMON_TOP/clone
8.0.6 ORACLE_HOME
iAS ORACLE_HOME
DB ORACLE_HOME
dbf files

After this stage now you need to configure the Target node. Basically you will run adcfgclone.pl same for databse tier and for application tier.
Let go in bit more detail:

First we will see for the database tier

On the target node you will run
ORACLE_DB_HOME/appsutil/clone/bin/perl adcfgclone.pl dbTier

Again there are two stages :

First will look at dbTechstack
It will use the driver files and templates which were created at source and has been copied to target.

Following scripts are run
-adchkutl.sh
-adclonectx.pl
-runInstallConfigDriver รข€”- located in $Oracle_Home/appsutil/driver/instconf.drv
-Relinking $Oracle_Home/appsutil/install/adlnkoh.sh

Now for database
-Driver file
$Oracle_Home/appsutil/clone/context/data/driver/data.drv
-Create database adcrdb.zip
-Autoconfig is run
-Control file creation adcrdbclone.sql

Now on application tier
from COMMON_TOP/clone/bin/perl adcfgclone.pl appsTier

Stage at TechStack
-Creates context file for target adclonectx.pl
-Run driver files
$Oracle_806_Home/appsutil/driver/instconf.drv
$Oracle_iAS_Home/appsutil/driver/instconf.drv

Relinking of Oracle Home
$Oracle_806_Home/bin/adlnk806.sh
$Oracle_iAS_Home/bin/adlnkiAS.sh

at the end for ApplTop stage
It runs driver and then autoconfig

So this will totally configure your application which has been copied.

At the end you have to some finishing tasks

-Update Printer settings
-Update Workflow Configuration settings
-Update Profile options

This completes you application cloning completely.

So Happy reading folks !!!!


Ref : http://onlineappsdba.com/index.php/2008/04/10/back-to-basics-of-cloning/

Hot Backup Cloning in 9i database :
***********************************

High Level Steps :
******************

1. Run preclone on both db as well apps Tier
2. Make a note of the current archive log change number using following command
SQL> select max(first_change#) chng from v$archived_log;
3. Make a note on db size and datafiles location and count(tablespace) using dba_data_files
4. Prepare the begin/end backup scripts
SQL> spool begin_backup.sql

select 'alter tablespace ' || tablespace_name || ' begin backup;' tsbb
from dba_tablespaces
where contents != 'TEMPORARY'
order by tablespace_name
/
SQL> spool off

SQL>spool end_backup.sql

select 'alter tablespace ' || tablespace_name || ' end backup;' tseb
from dba_tablespaces
where contents != 'TEMPORARY'
order by tablespace_name
/
SQL>spool off
5. Run begin_backup.sql script
6. Copy Datafiles,DB Home,Apps files from production to test server 
7. Run end_backup.sql script
8. Copy archive logs
It is only necessary to copy archive logs created during the time the source database was in backup mode. Begin by archiving the current redo:
SQL> alter system archive log current;
Then, identify which archive log files are required. When run, the following query will ask for a change number. This is the number noted in step 2.

SQL> select name from v$archived_log where first_change# >= &change_no order by name;

Create an archive directory in the clone database and copy all of the identified logs into it.
9. Create Controlfile trace on production and copy it to test.
SQL> alter database backup controlfile to trace as '/oracle/ctl.sql';
Edit ctl.sql file as follows,
a. The word 'REUSE' needs to be changed to 'SET'
b. The database name needs setting to the new database name
c. Decide whether the database will be put into archivelog mode or not
d. If the file paths are being changed, alter the file to reflect the changes
e. Make a copy of the 'ALTER TABLESPACE TEMP...' lines, and then remove them from the file. Make sure that you hang onto the command, it will be used later
10. Run adcfgclone.pl dbTechStack
  SQL> startup nomount pfile
  SQL> @ctl.sql
  SQL> recover database using backup controlfile until cancel
Apply all the archive logs which are required and apply current log file of production
SQL> alter database open resetlogs;
SQL> alter tablespace temp add tempfile '/oradata/temp01.dbf' size 50m reuse autoextend on next 1m maxsize 500m;
SQL> EXEC FND_CONC_CLONE.SETUP.CLEAN;
11. Run autoconfig on dbtier
12. Run adcfgclone.pl appsTier

RMAN CLONING USING MANUAL METHOD :
**********************************

High Level Steps :
******************
 
1. Run adpreclone on both tiers.
2. Take rman full backup with archivelogs and controlfile.
3. Copy rman backup pieces,db home,application files
4. Run adcfgclone.pl dbTechstack
5. Edit pfile only----db_name = source db name
6. startup nomount pfile
7. rman target /
8. restore controlfile from '/u01/backup/ctl/c-4423-20140116-00';
9. alter database mount; 
10. Prepare restore.rcv for restoration process
11. Run restore script
12. exit
13. sqlplus '/as sysdba'
14. Use the below command for 3 of the logfiles. If we are using same logfile location for both source and target database, no need to rename the logfiles.
    alter database rename file 'old logfile location' to 'newlogfile location';
15. alter database open resetlogs;
16. recreate controlfile file using following command and edit the db_name in ctl.sql and pfile 
    alter database backup controlfile to trace as '/u01/ctl.sql';
17. shut immediate
18. startup nomount pfile
19. Run ctl.sql
20. alter database open resetlogs;
21. alter tablespace TEMP add tempfile 'LOCATON' size 1024m autoextend on;
22. conn apps/apps
23. exec fnd_conc_clone.setup_clean;
24. commit;
25. Run autoconfig on db tier.
26. Run adcfgclone.pl on apps tier.


No comments:

Post a Comment