Oracle 12c - Oracle Home Cloning

Written by rajkiran on Sunday June 8, 2014

This note is about cloning and configuring an existing Oracle Home to a new location either on the same server or a different server. Cloning is much quicker especially when you are required to setup multiple database installations.

In this example, an existing Oracle Home on the server, 'kirlinc' is cloned to another server, 'kirlinb' with a different Oracle Home directory.

kirlinc: /data/oracle/app/oracle/product/12.1.0 --> kirlinb:/data/oracle/app/oracle/product/12R1


==> Stop all the processes that are using the Oracle Home to be cloned
==> create tarball (or a zip file) for the Oracle Home to be cloned
[oracle@kirlinc product]$ tar -cvf 12R1.tar /data/oracle/app/oracle/product/12.1.0
==> Copy the zip file / tarball to the target server/location
[oracle@kirlinc product]$ scp -p 12R1.tar kirlinb:/data/oracle/app/oracle/product/.
==> Extract the zip file / tarball contents. 
    Here, while extracting, I used strip-components option to ignore the absolute path (/data/oracle/app/oracle/product) from the tarfile
    Also, I used move command to rename the directory from 12.1.0 to 12R1 on the target server.
[oracle@kirlinb product]$ tar -xvf 12R1.tar --strip-components=5 && mv 12.1.0 12R1 
==> Use the clone.pl script to perform the clone. You can use option 'defaultHomeName' to have the Oracle Home autogenerated or use ORACLE_HOME_NAME to configure with a specific name.
[oracle@kirlinb bin]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/clone/bin/clone.pl ORACLE_BASE="/data/oracle/app/oracle" ORACLE_HOME="/data/oracle/app/oracle/product/12R1" OSDBA_GROUP=dba OSOPER_GROUP=dba -defaultHomeName
or 
[oracle@kirlinb bin]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/clone/bin/clone.pl ORACLE_BASE="/data/oracle/app/oracle" ORACLE_HOME="/data/oracle/app/oracle/product/12R1" OSDBA_GROUP=dba OSOPER_GROUP=dba ORACLE_HOME_NAME="12R1"
./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/data/oracle/app/oracle" "ORACLE_HOME=/data/oracle/app/oracle/product/12R1" "oracle_install_OSDBA=dba" "oracle_install_OSOPER=dba" "ORACLE_HOME_NAME=12R1" -silent -paramFile /data/oracle/app/oracle/product/12R1/clone/clone_oraparam.ini 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 7484 MB    Passed
Checking swap space: must be greater than 500 MB.   Actual 8191 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-03-13_06-23-47PM. Please wait ...You can find the log of this install session at:
 /data/oracle/app/oraInventory/logs/cloneActions2014-03-13_06-23-47PM.log
..................................................   5% Done.
..................................................   10% Done.
..................................................   15% Done.
..................................................   20% Done.
..................................................   25% Done.
..................................................   30% Done.
..................................................   35% Done.
..................................................   40% Done.
..................................................   45% Done.
..................................................   50% Done.
..................................................   55% Done.
..................................................   60% Done.
..................................................   65% Done.
..................................................   70% Done.
..................................................   75% Done.
..................................................   80% Done.
..................................................   85% Done.
..................................................   90% Done.
..................................................   95% Done.

Copy files in progress.

Copy files successful.

Link binaries in progress.

Link binaries successful.

Setup files in progress.

Setup files successful.

Setup Inventory in progress.

Setup Inventory successful.

Finish Setup in progress.

Finish Setup successful.
The cloning of 12R1 was successful.
Please check '/data/oracle/app/oraInventory/logs/cloneActions2014-03-13_06-23-47PM.log' for more details.

As a root user, execute the following script(s):
    1. /data/oracle/app/oracle/product/12R1/root.sh


..................................................   100% Done.
[oracle@kirlinb bin]$ su
Password: 
[root@kirlinb bin]# /data/oracle/app/oracle/product/12R1/root.sh
Check /data/oracle/app/oracle/product/12R1/install/root_kirlinb.home_2014-03-13_18-27-59.log for the output of root script
[root@kirlinb bin]# 

==> Verify the cloned Oracle Home
Run opatch lsinventory to check if the cloned oracle home and inventory are valid..
You can check inventory.xml as well under the Oracle Inventory directory
[oracle@kirlinb bin]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /data/oracle/app/oracle/product/12R1
Central Inventory : /data/oracle/app/oraInventory
   from           : /data/oracle/app/oracle/product/12R1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /data/oracle/app/oracle/product/12R1/cfgtoollogs/opatch/opatch2014-03-13_17-57-34PM_1.log

Lsinventory Output file location : /data/oracle/app/oracle/product/12R1/cfgtoollogs/opatch/lsinv/lsinventory2014-03-13_17-57-34PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1): 

Oracle Database 12c                                                  12.1.0.1.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.


[oracle@kirlinb ContentsXML]$ pwd
/data/oracle/app/oraInventory/ContentsXML
[oracle@kirlinb ContentsXML]$ ls
comps.xml  inventory.xml  inventory.xml.old  libs.xml
[oracle@kirlinb ContentsXML]$ more inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2013, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.1.0.1.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="12R1" LOC="/data/oracle/app/oracle/product/12R1" TYPE="O" IDX="1"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
[oracle@kirlinb ContentsXML]$ 

Categories: oracle database Tags: 12c oracle cloning