The Application DBA  

Creating Gold Copies for Cloning


Why clone? Why not just install, especially in a RAC cluster when the installer will install across all nodes? The answer boils down to which is faster, install or clone. For the first install and for patch set installations a full install is really the only option. But when applying one off, CPU or PSU patches, or duplicating an Oracle home to run a database in a separate Oracle home, it can be quite a bit faster to clone, and especially if patches have already been applied and will need to be retained.

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.

The process that will be followed will be to copy an existing Oracle home to another location, clean it and then create a final archive that can be used as the "gold" copy during future cloning.

Copy The Source Oracle Home

Since we’re cloning this Oracle home and it will be used multiple destinations we’ll first copy it to a temporary directory, preserving ownerships and permissions. If you're cloning another Oracle home onto the same server then you can just copy the Oracle home to the final destination and clean it in place. You can then make a gold copy from that instead of having to make a temporary copy.

As root:

# mkdir /tmp/db11203
# cd /u01/app/oracle/product/
# cp -pr * /tmp/db11023

Cleaning The Oracle Home

Note: The following steps should be used to create a “clean” Oracle home. Do not run these steps on a current Oracle home.

export GOLD_HOME=/tmp/db11203


mkdir tmp_dbs
ls -l dbs
mv dbs/initdw.ora tmp_dbs
mv dbs/init.ora tmp_dbs
rm -rf dbs/*
mv tmp_dbs/initdw.ora dbs
mv tmp_dbs/init.ora dbs
rmdir tmp_dbs
ls -l dbs

cd $GOLD_HOME/network/admin
rm tnsnames*
rm listener*
rm sqlnet*
ls –l

ls -l rdbms/audit
rm rdbms/audit/*
ls -l rdbms/audit

ls -l log
#rm old nodes

ls -l cfgtoollogs/oui
cd $GOLD_HOME/cfgtoollogs/oui
rm *
ls -l cfgtoollogs/oui

Remove any node specific directories.

Create The Gold Copy

We can now create an archive file for the source Oracle home. This will become our "gold" copy. Almost every document uses a different method. Since these and the following examples are using Linux, and personal preference, we’ll use tar with the gzip option.

As root:

cd /tmp/db11023
tar –zcvf /orasrc/gold_copies/db11203.tgz .

Deploying the Gold Copy

The gold copy can now be deployed where ever it's needed. To deploy the gold copy create a target Oracle home directory:

As oracle:

cd /u01/app/oracle
mkdir -p product/

Untar the source Oracle home into the target directories:

As root:

cd /u01/app/oracle/product/
tar -zxvpf /orasrc/gold_copies/db11203.tgz .

Copyright 1998-2013 AppsDBA Consulting. All Rights Reserved.