VMCD.ORG

Focus on database mail:ylouis83#gmail.com

Cloning an Oracle Home

Posted by admin on March 2nd, 2012

Cloning an Oracle Home

Cloning an Oracle home involves creating a copy of the Oracle home and then configuring it for a new environment. If you are performing multiple Oracle Database installations, then you may want to use this method to create each Oracle home, because copying files from an existing Oracle Database installation takes less time than creating a new version of them. This method is also useful if the Oracle home that you are cloning has had patches applied to it. When you clone the Oracle home, the new Oracle home has the patch updates.
 
When you clone Oracle homes using release 11.2 Database Control, you must update the exclude file list. This file list specifies files that need not be included when the source Oracle home is archived because these files are not required for the cloning operation. Do not include the following files in the archive:
 
sqlnet.ora
tnsnames.ora
listener.ora
oratab


Note:
In addition to cloning an Oracle home, you can clone individual Oracle Database installations by using Oracle Enterprise Manager Database Control. Oracle Database Administrator's Guide provides detailed information about cloning Oracle Database installations and Oracle homes.
This appendix includes information about the following topics:
 
Cloning an Oracle Home
Configuring Oracle Configuration Manager in a Cloned Oracle Home
B.1 Cloning an Oracle Home
 
Perform the following to clone an Oracle home:
 
Verify that the installation of Oracle Database to clone is successful.
 
You can do this by reviewing the installActionsdate_time.log file for the installation session, which is typically located in the /orainventory_location/logs directory.
 
If you install patches, then check their status using the following:
 
$ cd $ORACLE_HOME/OPatch
Include $ORACLE_HOME/OPatch in $PATH
 
$ opatch lsinventory
Stop all processes related to the Oracle home. See Chapter 7, "Removing Oracle Database Software" for more information about stopping the processes for an Oracle home.
 
Create a ZIP file with the Oracle home (but not the Oracle base) directory.
 
For example, if the source Oracle installation is in the /u01/app/oracle/product/11.2.0/dbhome_1, then you zip the dbhome_1 directory by using the following command:
 
# zip -r dbhome_1.zip /u01/app/oracle/product/11.2.0/dbhome_1
Do not include the admin, fast_recovery_area, and oradata directories that are under the Oracle base directory. These directories are created in the target installation later, when you create a new database there.
 
Copy the ZIP file to the root directory of the target computer.
 
Extract the ZIP file contents by using the following command:
 
# unzip -d / dbhome_1.zip
Repeat steps 4 and 5 for each computer where you want to clone the Oracle home, unless the Oracle home is on a shared storage device.
 
On the target computer, change the directory to the unzipped Oracle home directory, and remove all the .ora (*.ora) files present in the unzipped $ORACLE_HOME/network/admin directory.
 
From the $ORACLE_HOME/clone/bin directory, run the clone.pl file for the unzipped Oracle home. Use the following syntax:
 
$ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE="target_oracle_base" ORACLE_HOME="target_oracle_home"
OSDBA_GROUP=OSDBA_privileged_group OSOPER_GROUP=OSOPER_privileged_group -defaultHomeName
For example:
 
$ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE="/u01/app/oracle/" ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"
OSDBA_GROUP=dba OSOPER_GROUP=oper -defaultHomeName
Oracle Universal Installer starts, and then records the cloning actions in the cloneActionstimestamp.log file. This log file is typically located in /orainventory_location/logs directory.
 
To configure the connection information for the new database, run Net Configuration Assistant:
 
$ cd $ORACLE_HOME/bin
$ ./netca
To create a new database for the newly cloned Oracle home, run Database Configuration Assistant:
 
$ cd $ORACLE_HOME/bin
$ ./dbca
See Also:
Oracle Universal Installer and OPatch User's Guide for Windows and UNIX for detailed information about using Oracle Universal Installer to clone an Oracle Database home
 
Oracle Database Administrator's Guide for information about cloning Oracle databases and cloning an Oracle Database home
 
B.2 Configuring Oracle Configuration Manager in a Cloned Oracle Home
 
Perform the following to configure Oracle Configuration Manager for a cloned Oracle home:
 
Run the following command from $ORACLE_HOME/ccr/state:
$ rm -rf *.ll*
Run the following command from $ORACLE_HOME/ccr/inventory:
$ cp core.jar pending
Run the following commands from $ORACLE_HOME/ccr/bin:
$ ./emSnapshotEnv
$ ./deployPackages
Run the following command from $ORACLE_HOME/ccr/bin and provide the proper credentials:
$ ./configCCR
If Oracle Configuration Manager was manually configured using setupCCR, then perform the following in the cloned Oracle home:
 
Delete all the subdirectories of the $ORACLE_HOME/ccr/hosts directory to remove previously configured hosts.
 
Run the following command from $ORACLE_HOME/ccr/bin:
 
$ ./configCCR -a
If you installed Oracle Configuration Manager in the original Oracle home but have not configured it, then run the following command in the cloned Oracle home:
 
$ setupCCR

下面给个范例:

[oracle@rac03 bin]$ /data/oracle/product/11203/db1/perl/bin/perl clone.pl ORACLE_BASE="/data/oracle" ORACLE_HOME="/data/oracle/product/11203/db1" OSDBA_GROUP=dba -defaultHomeName
./
runInstaller -clone -waitForCompletion  "ORACLE_BASE=/data/oracle" "ORACLE_HOME=/data/oracle/product/11203/db1" "oracle_install_OSDBA=dba" -defaultHomeName  -defaultHomeName -silent -noConfig -nowait
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 129576 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2012-02-14_02-44-44PM. Please wait ...Oracle Universal Installer, Version 11.2.0.3.0 Production
Copyright (C) 1999, 2011, Oracle. All rights reserved.
 
You can find the log of this install session at:
/
home/oracle/oraInventory/logs/cloneActions2012-02-14_02-44-44PM.log
....................................................................................................
100% Done.
 
 
 
Installation in progress (Tuesday, February 14, 2012 2:44:54 PM CST)
...............................................................................                                                 
79% Done.
Install successful
 
Linking in progress (Tuesday, February 14, 2012 2:45:00 PM CST)
Link successful
 
Setup in progress (Tuesday, February 14, 2012 2:45:51 PM CST)
Setup successful
 
End of install phases.(Tuesday, February 14, 2012 2:46:14 PM CST)
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script '/home/oracle/oraInventory/orainstRoot.sh' with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.
The following configuration scripts need to be executed as the "root" user.
/
home/oracle/oraInventory/orainstRoot.sh
/
data/oracle/product/11203/db1/root.sh
To execute the configuration scripts:
    
1. Open a terminal window
    
2. Log in as "root"
    
3. Run the scripts
    
The cloning of OraHome1 was successful.
Please check '/home/oracle/oraInventory/logs/cloneActions2012-02-14_02-44-44PM.log' for more details.

可见oracle clone 自动进行了relink 和 oraInventory 创建,完全可以代替relink 进行数据库soft的迁移工作。

One Response to “Cloning an Oracle Home”

  1. vmcd Says:

    How to clone the Oracle database software

    This note describes the process of cloning an Oracle Home – in this case we are cloning a 11g Release 2 Oracle Home from source machine devastator to target machine vixen.

    On source (devastator)

    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

    devastator:$ pwd

    devastator:$ /u01/app/oracle/product/11.2.0

    devastator:$ tar -cvf 11gr2.tar dbhome_1

    On Target (vixen)

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

    On Source

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

    devastator:$ scp -rp 11gr2.tar oracle@vixen:/u01/app/oracle/product/11.2.0

    On target

    Uncompress the tar file

    vixen:$ cd /u01/app/oracle/product/11.2.0

    vixen:$ tar -xvf 11gr2.tar

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

    vixen:$ cd /u01/app/oracle/product/11.2.0/dbhome_1/clone/bin

    vixen:$ 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

    # pwd
    /u01/app/oracle/product/11.2.0/dbhome_1

    # ./root.sh
    Check /u01/app/oracle/product/11.2.0/dbhome_1/install/root_devastator_2010-06-29_07-42-31.log for the output of root script

    vixen:$cat /u01/app/oracle/product/11.2.0/dbhome_1/install/root_vixen_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.

    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

    vixen:$ cat /var/opt/oracle/oraInst.loc
    inventory_loc=/u01/app/oracle/oraInventory

    We can identified inventory location by myself using INVENTORY_LOCATION parameter

    Like:

    perl clone.pl ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=Oracle_home_name ‘-O”sl_tableList={new_node:new_node-priv:new_node-vip}”‘ ‘-O-noConfig”-O”INVENTORY_LOCATION=central_inventory_location”‘

    (note:this is on Rac env)

    inst_group=dba

    vixen:$cd /u01/app/oracle/oraInventory

    vixen:$ ls
    backup ContentsXML logs oraInstaller.properties oui
    Contents install.platform oraInst.loc orainstRoot.sh sessionContext.se

    vixen:$cd ContentsXML

    vixen:$ ls
    comps.xml inventory.xml libs.xml

    vixen:$ vi inventory.xml


    11.2.0.1.0
    2.1.0.6.0

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>