Clone Oracle install ( Cloning ORACLE_HOME )


Many a times it’s required to copy the existing ORACLE_HOME and create new environments. 
This also saves patching time if you have to install and apply all the needed patches to your newly installed home to make it current as your existing ORACLE_HOME.
Cloning an ORACLE_HOME is much faster than installing and applying the patches.
Advantages and disadvantages of cloning
Advantages
·         Creating an installation that is a copy of a production, test, or development installation.
·         Cloning enables you to create a new installation with all patches applied to it in a single step. This contrasts with going through the installation process by performing separate steps to install, configure, and patch the installation.
·         Rapidly deploying an instance and the applications that it hosts.
·         Preparing an Oracle Home and deploying it to many hosts.
·         You can also customize various aspects of cloning, for example, to specify custom port assignments, or to preserve custom settings.
Disadvantages
·         The cloning process copies all of the files from the source Oracle Home to the
destination Oracle Home. Thus, any files used by the source instance located outside
the source Oracle Home's directory structure are not copied to the destination location.
·         Cloning is not possible across platforms

 Actual Process of cloning
Pre-reqs :
Perl 5.6 or higher is required for cloning and should be set in the environment.

The cloning process has two phases:

1. Source Preparation Phase
·         During this phase, prepare_clone.pl parses files in the source Oracle Home to extract and store the required values.
·         At the source, run a script called prepare_clone.pl.
·         This is a Perl script that prepares the source for cloning by recording the information required for cloning.
·         This script is generally found in the following location:
$ORACLE_HOME/clone/bin/prepare_clone.pl
NOTE: The need to perform the preparation phase depends on the Oracle product you are installing. This script needs to be executed only for the Application Server Cloning. Database and CRS Oracle Home cloning do not require this.
·         Archive and compress the source Oracle Home using your preferred archiving tool.

For example:
You can use WinZip on Microsoft Windows system computers and tar or gzip on UNIX. Make sure that the tool that you use preserves the permissions and file timestamps.
·         When archiving the home, also ensure that you skip the *.log, *.dbf, listener.ora, sqlnet.ora, and tnsnames.ora for archiving.
2. Cloning Phase
·         On the destination system, you unarchive the Oracle Home and run the clone.pl script.
·         This Perl script performs all parts of the cloning operation automatically by running OUI and various other utilities.
·         This script uses the cloning functionality in OUI. When you run the clone.pl script, it handles the specifics that OUI may have missed.
·         The Central Inventory of the box where the home is being cloned is updated as is the Oracle Home inventory ($ORACLE_HOME/inventory).

Note: The cloned home and source home will not be identical in size, because the cloned home will have additional files created during the cloning operation.

All the logs can be found in <Central_Inventory>/logs folder and <ORACLE_HOME>/clone/logs.
For more detailed information refer the Note 403212.1 (Location Of Logs For Patch And OUI) which contains detailed information about the location of the log files for each command.

Note:
1)      Copying Central Inventory is not required because:
·         If it is not the first Oracle Home on the target Server:
         Cloning will update the central inventory with the information regarding the new home.
·         If it is the first oracle home on the target Server:
         Cloning will create a central inventory with the information regarding the new home.
2)      you can clone with a different operating system user and group.
Refer Metalink Note 558478.1 Cloning A Database Home And Changing The User/Group That Owns It


Commands
Eg:
Windows :
perl <Oracle_Home>\clone\bin\clone.pl ORACLE_HOME="C:\u01\app\product\oracle\clone_home" ORACLE_HOME_NAME="CLONE"
Linux-based and UNIX-based systems:

perl <Oracle_Home>/clone/bin/clone.pl ORACLE_HOME="/u01/app/product/oracle/clone_home" ORACLE_HOME_NAME="CLONE"

On UNIX/Linux installations, after the cloning operation is completed, it is mandatory to run root.sh (as root) in the cloned Oracle Home.

References
NOTE:300062.1 - How To Clone An Existing RDBMS Installation Using OUI
NOTE:403212.1 - Location Of Logs For Opatch And OUI
NOTE:454442.1 - 11g Install : Understanding about Oracle Base, Oracle Home and Oracle Inventory locations
NOTE:558478.1 - Cloning A Database Home And Changing The User/Group That Owns It

Comments

  1. Do we need to bring down the databases when we archive the source oracle_home.

    ReplyDelete

Post a Comment