Tuesday, October 23, 2012

Cloning Oracle Database Home

Following are the step by step method of cloning an Oracle 11g 11.2.0.2 Database Home from source server(ProdA) to a target server(TestA).

1. Check the patches applied on source ProdA server and the size of the oracle home directory,

[oracle@proda dbhome_1]$ opatch lsinv
[oracle@proda dbhome_1]$ du -h . tail

2. On TestA target server create directory for oracle home, change ownership to oracle user and then on source ProdA server tar oracle home and copy to destination TestA server,

[root@testa ~]# mkdir -p /oracle/app/product/11.2.0/dbhome_1
[root@testa ~]# chown -R oracle:dba /oracle
[oracle@proda ~]$ cd /oracle/app/product/11.2.0/dbhome_1
[oracle@proda dbhome_1]$ tar cvf - .
[oracle@proda dbhome_1]$ scp *.tar testa:/oracle/app/product/11.2.0/dbhome_1
[oracle@testa ~]$ cd /oracle/app/product/11.2.0/dbhome_1
[oracle@proda dbhome_1]$ tar xvf *.tar

3. On TestA target server detach the oracle home (This step is required only if the server itself is a clone/image of the source server or if oracle home was already registered in the inventory)

[oracle@testa ~]$ cd /oracle/app/product/11.2.0/dbhome_1/oui/bin
[oracle@testa bin]$ ./runInstaller -detachHome ORACLE_HOME="/oracle/app/product/11.2.0/dbhome_1"

4. Now do the cloning of oracle home,

[oracle@testa bin]$ ./runInstaller -clone -silent -ignorePreReq ORACLE_HOME="/oracle/app/product/11.2.0/dbhome_1" ORACLE_HOME_NAME="dbhome_11gR2" ORACLE_BASE="/oracle/app" OSDBA_GROUP=dba OSOPER_GROUP=dba

Once the above step is successful then execute root.sh script as root,

[root@testa ~]# /oracle/app/product/11.2.0/dbhome_1/root.sh

Finally you can check the cloned home and crosscheck the patchset level from the result seen in step 1, both will be same.

[oracle@testa ~]$ opatch lsinv

5. Post cloning steps is to accordingly update the files in $ORACLE_HOME/dbs and $ORACLE_HOME/network/admin folders.

On Windows:
After doing step 1 and 2 as above then from step 3 do the following,

SET PATH=I:\r11i\ebstestdb\10.2.0\bin;I:\r11i\ebstestdb\10.2.0\jdk\jre\bin;%PATH%

cd I:\r11i\ebstestdb\10.2.0\oui\bin

# setup.exe -clone -silent -ignorePreReq ORACLE_HOME="I:\r11i\ebstestdb\10.2.0" ORACLE_HOME_NAME="dbhome_11107" ORACLE_BASE="I:\r11i"
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
 Preparing to launch Oracle Universal Installer from C:\DOCUME~1\sami\LOCALS~1\Temp\1\OraInstall2013-02-10_12-15-02PM. Please wait ... Oracle Universal Installer, Version 10.2.0.4.0 Production
Copyright (C) 1999, 2008, Oracle. All rights reserved.

You can find a log of this install session at:
 C:\Program Files\Oracle\Inventory\logs\cloneActions2013-02-10_12-15-02PM.log
....................................................................................................Dll to load is C:\DOCUME~1\sami\LOCALS~1\Temp\1\OraInstal
l2013-02-10_12-15-02PM\Win64RunProcesses.dll
Loading psapi.dll from C:\DOCUME~1\sami\LOCALS~1\Temp\1\OraInstall2013-02-10_12-15-02PM\psapi.dll
 100% Done.


Installation in progress (Sunday, February 10, 2013 12:15:52 PM GST)
.........................................................................
                                                73% Done.
Install successful

Setup in progress (Sunday, February 10, 2013 12:16:07 PM GST)
Problem in getting file info: No such file or directory toLoad is C:\DOCUME~1\sami\LOCALS~1\Temp\1\OraInstall2013-02-10_12-15-02PM\win64ocxReg.dll
ERROR: Cannot add user to application access ACL.
No mapping between account names and security IDs was done.
(534)
ERROR: Cannot add user to application launch ACL.
No mapping between account names and security IDs was done.
(534)
Setup successful

End of install phases.(Sunday, February 10, 2013 12:16:27 PM GST)
The cloning of dbhome_11107 was successful.
Please check 'C:\Program Files\Oracle\Inventory\logs\cloneActions2013-02-10_12-15-02PM.log' for more details.
Please press Enter to exit...

For more details you can refer to following MOS documents and don't hesitate to contact me as well samiora@gmail.com:

Master Note For Cloning Oracle Database Server ORACLE_HOME's Using the Oracle Universal Installer (OUI) (Doc ID 1154613.1)
Cloning An Existing Oracle11g Release 2 (11.2.0.x) RDBMS Installation Using OUI (Doc ID 1221705.1)
FAQs on RDBMS Oracle Home Cloning Using OUI (Doc ID 565009.1)