Sunday, March 3, 2013

How to Clone Oracle Home to a Remote Server

1- Check the oracle home you will clone to the new server
bash-3.2$ ./opatch lsinventory

Invoking OPatch 11.2.0.1.7
Oracle Interim Patch Installer version 11.2.0.1.7
Copyright (c) 2011, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /var/opt/oracle/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2013-02-25_07-48-52AM.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-02-25_07-48-52AM.txt
--------------------------------------------------------------------------------

Installed Top-level Products (1):
Oracle Database 11g 11.2.0.3.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------

OPatch succeeded.


2- Check the oracle home size

bash-3.2$ cd /u01/app/oracle/product/11.2.0/dbhome_1

bash-3.2$ du -sh .
4.2G .

3- Create the same directory tree on the remote server as the source server and change ownership to oracle user

bash-3.2# mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1

bash-3.2# chown -R oracle:oinstall /u01

4- On source server execute tar command to copy over the network the oracle home directories to the target server

bash-3.2$ cd /u01/app/oracle/product/11.2.0/dbhome_1

bash-3.2$ tar cvf - . ( ssh lnx2 "cd /u01/app/oracle/product/11.2.0/dbhome_1 ; tar xvf -" )

5- On the target server once the tar command finishes to copy on the target oracle home check the total size and must be the same as the source server

bash-3.2$ cd /u01/app/oracle/product/11.2.0/dbhome_1

bash-3.2$ du -sh .
4.2G

6- Before starting clone process we need to detach the inventory because the server was itself a clone of the source

bash-3.2$ cd /u01/app/oracle/product/11.2.0/dbhome_1/oui/bin

bash-3.2$ ./runInstaller -detachHome ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"

Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 7917 MB Passed
The inventory pointer is located at /var/opt/oracle/oraInst.loc
The inventory is located at /u01/app/oraInventory
'DetachHome' was successful.
Using the OUI to finish the cloning process



7- Once the inventory was detached from the old server version I can run the cloning procedure

bash-3.2$ cd /u01/app/oracle/product/11.2.0/dbhome_1/oui/bin

bash-3.2$ ./runInstaller -clone -silent -ignorePreReq ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1" ORACLE_HOME_NAME="dbhome_11gR2" ORACLE_BASE="/u01/app/oracle" OSDBA_GROUP=dba OSOPER_GROUP=dba
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 7916 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-02-24_11-29-35AM. Please wait ...bash-3.2$ 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:
/u01/app/oraInventory/logs/cloneActions2013-02-24_11-29-35AM.log
.................................................................................................... 100% Done.
Installation in progress (Sunday, February 24, 2013 11:31:04 AM EET)
............................................................................... 79% Done.
Install successful
Linking in progress (Sunday, February 24, 2013 11:31:40 AM EET)
Link successful
Setup in progress (Sunday, February 24, 2013 11:35:36 AM EET)
Setup successful
End of install phases.(Sunday, February 24, 2013 11:36:09 AM EET)

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 dbhome_11gR2 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2013-02-24_11-29-35AM.log' for more details.

8- The last step is to execute the root.sh script on the target server as root user

bash-3.2$ su -

bash-3.2# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Creating /usr/local/bin directory...
Creating /var/opt/oracle/oratab file...
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 script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

9- Now,check the Cloned Oracle Home and it must give the same output as the source server

bash-3.2$ ./opatch lsinventory

Invoking OPatch 11.2.0.1.7
Oracle Interim Patch Installer version 11.2.0.1.7
Copyright (c) 2011, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /var/opt/oracle/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2013-02-25_07-48-52AM.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-02-25_07-48-52AM.txt
--------------------------------------------------------------------------------

Installed Top-level Products (1):
Oracle Database 11g 11.2.0.3.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------

OPatch succeeded.

No comments: