Tuesday 31 March 2015

How to clone the Oracle database software



This note describes the process of cloning an Oracle Home - in this case we are cloning 11g Release 2 Oracle Home from source machine DEV to target machine QA.

STEP 1: Take tar backup of source oracle home location

On source (DEV)

ORACLE_HOME location is: /u01/app/oracle/product/11.2.0/dbhome_1

Go to directory on source machine one level higher and tar the db_home1 directory and all sub-directories

[oracle@(DEV):~]$ pwd

[oracle@(DEV):~]$ /u01/app/oracle/product/11.2.0 

[oracle@(DEV):~]$ tar -cvf 11gr2.tar dbhome_1

STEP 2: Create required directory on target database

On Target (QA)

Create the directory /u01/app/oracle/product/11.2.0 if it does not exist

STEP 3: Scp tar backup of target server and uncompress it.

On Source

scp or ftp the tar file to this location on the target machine

[oracle@(DEV):~]$scp -rp 11gr2.tar oracle@qa:/u01/app/oracle/product/11.2.0 

On target (QA)

Uncompress the tar file

[oracle@(QA):~]$ cd /u01/app/oracle/product/11.2.0

[oracle@(QA):~]$ tar -xvf 11gr2.tar

STEP 4: Clone the Oracle Home using the perl script clone.pl which is located under the $ORACLE_HOME/clone/bin

[oracle@(QA):~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/clone/bin

[oracle@(QA):~]$ perl clone.pl ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 ORACLE_HOME_NAME=11GR2_HOME

./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/u01/app/oracle" "ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1" "ORACLE_HOME_NAME=11GR2_HOME" -silent -noConfig -nowait
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 13044 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2010-06-28_12-19-47PM. Please wait ...Oracle Universal Installer, Version 11.2.0.1.0 Production
Copyright (C) 1999, 2009, Oracle. All rights reserved.

You can find the log of this install session at:
 /u01/app/oracle/oraInventory/logs/cloneActions2010-06-28_12-19-47PM.log
.................................................................................................... 100% Done.



Installation in progress (Monday, June 28, 2010 12:20:29 PM WST)
..............................................................................                                                  78% Done.
Install successful

Linking in progress (Monday, June 28, 2010 12:21:06 PM WST)
Link successful

Setup in progress (Monday, June 28, 2010 12:23:34 PM WST)
Setup successful

End of install phases.(Monday, June 28, 2010 12:34:05 PM WST)
Starting to execute configuration assistants
The following configuration assistants have not been run. This can happen because Oracle Universal Installer was invoked with the -noConfig option.
--------------------------------------
The "/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/configToolFailedCommands" script contains all commands that failed, were skipped or were cancelled. This file may be used to run these configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
The "/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/configToolAllCommands" script contains all commands to be executed by the configuration assistants. This file may be used to run the configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.

--------------------------------------
WARNING:
The following configuration scripts need to be executed as the "root" user.
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts

The cloning of 11GR2_HOME was successful.
Please check '/u01/app/oracle/oraInventory/logs/cloneActions2010-06-28_12-19-47PM.log' for more details.

Run the root.sh script as root

[oracle@(QA):~]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1

[oracle@(QA):~]$./root.sh
Check /u01/app/oracle/product/11.2.0/dbhome_1/install/root_dev_2010-06-29_07-42-31.log for the output of root script

[oracle@(QA):~]$cat /u01/app/oracle/product/11.2.0/dbhome_1/install/root_qa_2010-06-29_07-42-31.log

Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_1
Entries will be added to the /var/opt/oracle/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

STEP 4: Check oraInventory has updated with new oracle home.

We can now check that the OraInventory has been updated with the 11g Release 2 Oracle Home details.

On this machine, earlier there was only a 10g Oracle Home installed. When we check the contents of the inventory.xml file, we will see that it has information about the 11g Oracle Home – 11GR2_HOME

[oracle@(QA):~]$ cat /var/opt/oracle/oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=dba

[oracle@(QA):~]$cd /u01/app/oracle/oraInventory

[oracle@(QA):~]$ ls
backup                   ContentsXML              logs                     oraInstaller.properties  oui
Contents                 install.platform         oraInst.loc              orainstRoot.sh           sessionContext.se

[oracle@(QA):~]$ cd ContentsXML

[oracle@(QA):~]$  ls
comps.xml      inventory.xml  libs.xml


[oracle@(QA):~]$ vi inventory.xml 

<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2009, Oracle. All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.1.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="ora1020" LOC="/u01/app/oracle/product/10.2.0" TYPE="O" IDX="1"/>
<HOME NAME="11GR2_HOME" LOC="/u01/app/oracle/product/11.2.0/dbhome_1" TYPE="O" IDX="2"/>
</HOME_LIST>
</INVENTORY>


It’s done. J






I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!