Single Instance Oracle Home Cloning
The following basic steps will be performed to clone the single instance database Oracle home.
- Create a new target directory.
- Un-tar the source Oracle home (i.e. gold copy) into the target directory.
- Update the oratab file.
- Run the Oracle clone.pl script to register the Oracle home.
- Verify the local and central inventories.
- Apply any required patches.
Create New Oracle Home
Create the new Oracle home and unarchive a gold copy or a "clean" source copy into the new directory (see Creating Gold Copies for Cloning).
mkdir -p product/22.214.171.124/db_1
Untar the source Oracle home into the target directories:
tar -zxvpf /orasrc/gold_copies/db11203.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:
Run Clone Utility
The following steps to run the clone.pl script should be done 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
$ export ORACLE_BASE=/u01/app/oracle
$ export ORACLE_HOME=/u01/app/oracle/product/126.96.36.199/db_1
$ export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib
Run the clone.pl script:
To clone a single instance Oracle home all you need is the $ORACLE_BASE, $ORACLE_HOME and the ORACLE_HOME_NAME. The ORACLE_HOME_NAME must be unused or previously deleted and Oracle's default naming for 11g R2 seems to follow "OraDb11g_home<n>". The name can be anything you want and you can find the currently used names in the central inventory.
perl $ORACLE_HOME/clone/bin/clone.pl ORACLE_BASE=$ORACLE_BASE
Note: The script will ask you to run the root.sh script.
Check Inventory Files
To check the inventory files (i.e. local and central):
Note: The central inventory file location can be found in the oraInst.loc file located in /etc on Linux.
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
Apply patches to the cloned Oracle home
Any patches can now be applied to the cloned Oracle home. 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. If these patches will be the basis of a new gold copy then now is the time to create that copy.
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.
Oracle® Database Installation Guide,
11g Release 2 (11.2) for Linux, Section B Cloning an Oracle Home