The Application DBA  

RAC Oracle Home Cloning (Fast Clone)

Introduction

The following procedures and examples come from an 11.2 RAC cluster running Linux. Although most of the Oracle documentation states that the services running out of the Oracle home to be cloned must be stopped, there are also other notes and this guide that have found this not to be the case. This section has been successfully tested with cloning 11.2, 11.1 and 10.2 Oracle homes into an 11.2 cluster. There are two additional sections that deal with switching over to a cloned home in a rolling manner to minimize downtime. This can be helpful when cloning an Oracle home to apply patches and then switching running databases to the new Oracle home.

The following basic steps will be performed to clone the RAC database Oracle home.

  1. Create new target directories on all target nodes.
  2. Un-tar the source Oracle home into the target directories.
  3. Update the oratab file on each node.
  4. Run the Oracle clone.pl script to register the Oracle homes on all nodes from one of the new Oracle homes.
  5. Verify the local and central inventories on each node.
  6. Apply any required patches.

Create New Oracle Home

Create new target directories

These procedures will use following format:

/u01/app/oracle/product/11.2.0/db_2

Create new Oracle home directories on each node as oracle and verify the proper ownership of the new directory (i.e. oracle:oinstall):

cd /u01/app/oracle/product/11.2.0
mkdir db_2
chown oracle:oinstall db_2

Note: This example assumes that the /u01/app/oracle/product/11.2.0 directory already exists and that we're adding a seconde Oracle home.

Copy and untar the source Oracle home as root into the target directory on each node

As root:

cd /u01/app/oracle/product/11.2.0/db_2
tar -zxvpf /orasrc/gold_copies/db11203_clone.tgz .

Update the oratab file (optional)

Update the oratab file and add the new Oracle home. The new entry for this example should look like this:

*:/u01/app/oracle/product/11.2.0/db_2:N

Run Clone Utility

For each cloned Oracle home run the following as oracle:

Set the environment to the new Oracle home:

Note: It’s easiest to add the new ORACLE_HOME to the oratab file and run orasetup to set the environment correctly.

$ . orasetup

or

$ export ORACLE_BASE=/u01/app/oracle
$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_2
$ export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Run the clone.pl script:

On each node run the clone.pl following, updating the values as appropriate:

cd $ORACLE_HOME

E01=ORACLE_HOME=$ORACLE_HOME
E02=ORACLE_HOME_NAME=OraDb11g_home2
E03=ORACLE_BASE=$ORACLE_BASE
THISNODE=`hostname -s`
C01="-O \"CLUSTER_NODES={node1,node2}\""
C02="-O'\"LOCAL_NODE=$THISNODE\"'"

perl $ORACLE_HOME/clone/bin/clone.pl $E01 $E02 $E03 $C01 $C02

Note: The script will ask you to run the root.sh script.

On the primary node run the following to update the node list in the local and central inventory files:

$ORACLE_HOME/oui/bin/runInstaller –updateNodeList \
"CLUSTER_NODES={node1,node2}" \
ORACLE_HOME="$ORACLE_HOME" ORACLE_HOME_NAME="OraDb11g_home2" \
LOCAL_NODE="node1"

Check inventory files:

cat /u01/app/oraInventory/ContentsXML/inventory.xml
cat $ORACLE_HOME/inventory/ContentsXML/oraclehomeproperties.xml

Verify the central inventory on each node

The easiest way to verify that the central inventory has been properly updated is to run an opatch lsinventory command from the cloned Oracle home:

$ opatch lsinventory

11.1 and 10.2 Note - Pin Nodes

# olsnodes -t
node1     Unpinned
node2     Unpinned
# crsctl pin css -n node1
CRS-4664: Node node1 successfully pinned.
# crsctl pin css -n node2
CRS-4664: Node node2 successfully pinned.
# olsnodes -t
node1     Pinned
node2     Pinned
#

Apply patches to the cloned Oracle home

Any patches can now be applied to the cloned Oracle homes. The idea here is to save down time by performing all non-database specific tasks while the database(s) continue to run in their original Oracle home.

Note: Any database required scripts that are included in the patches applied to the Oracle home that have not been previously run will need to be run once the database is switched to the cloned Oracle home.

References

Oracle® Real Application Clusters Administration and Deployment Guide, 11g Release 2 (11.2) – Cloning Oracle RAC to Nodes in a New Cluster

Oracle Clusterware Administration and Deployment Guide, 11g Release 2 – Cloning Oracle Clusterware

Oracle Database Installation Guide, 11g Release 2 (11.2) for Linux, Cloning an Oracle Home

Oracle Universal Installer and OPatch User’s Guide, 11g Release 2 (11.2) for Windows and UNIX

Oracle® Universal Installer and OPatch User's Guide, 11g Release 1 (11.1) for Windows and UNIX

Minimal downtime patching via cloning 11gR2 ORACLE_HOME directories [ID 1136544.1]

Master Note For Cloning Oracle Database Server ORACLE_HOME's Using the Oracle Universal Installer (OUI) [ID 1154613.1]

How to Clone an 11.2.0.3 Grid Infrastructure Home and Clusterware [ID 1413846.1]

Oracle Universal Installer (OUI) FAQ [ID 458893.1]

Copyright 1998-2013 AppsDBA Consulting. All Rights Reserved.