Skip to content

How to Clone Oracle Grid Infrastructure / Restart and database Home

Following instructions can be used to clone Oracle Grid Infrastructure Restart from already working Oracle Linux Server to another new server.  This method can save a lot of time in installing the GI Software, oracle database software and then applying PSU patch to every new server.

 

Assumption: You already have the OS template or server with Oracle Linux 6.4, Oracle Grid Infrastructure(GI) and Database software 11gR2 installed.  Also, the binaries are already been copied to target server.

These instructions can also be used for environments created using VDI or OVM template with Oracle software already installed.

In my configuration I have installed GI in /grid and Oracle Database in /oracle.

Copy GI/ASM home and database home to new server.

 Cloning GI Home

ROOT tasks (only needed if HAS is already configured)

/grid/product/11.2.0/grid/crs/install/roothas.pl -deconfig -force

Clean up Log files and server specific directories.

find /grid/product/11.2.0/grid -name "*.log" -exec rm -f {} \;
find /grid/product/11.2.0/grid -name "myserver" -exec rm -rf {} \;
find /grid/product/11.2.0/grid/gpnp -type f -exec rm -f {} \;
find /grid/product/11.2.0/grid/cfgtoollogs -type f -exec rm -f {} \;

rm -rf /grid/product/11.2.0/grid/crs/init/*
rm -rf /grid/product/11.2.0/grid/cdata/*
rm -rf /grid/product/11.2.0/grid/crf/*
rm -rf /grid/product/11.2.0/grid/log/myserver
find /grid/product/11.2.0/grid -name '*.ouibak' -exec rm {} \;
find /grid/product/11.2.0/grid -name '*.ouibak.1' -exec rm {} \;
rm -rf /etc/oracle/*
rm -rf /grid/product/11.2.0/grid/log/myserver

Fix permissions for following files:

chmod u+s /grid/product/11.2.0/grid/bin/oracle
chmod g+s /grid/product/11.2.0/grid/bin/oracle
chmod u+s /grid/product/11.2.0/grid/bin/extjob
chmod u+s /grid/product/11.2.0/grid/bin/jssu
chmod u+s /grid/product/11.2.0/grid/bin/oradism

Non-root tasks (i.e. /grid owner)

Make sure init.ohasd process is not running.  If it is become root and kill it.

ps -ef | grep has

Detach GI Home from existing inventory – only needed if you copied the binaries to different directory structure than source (i.e. source had /grid/product/11.2.0/grid and you copied it to /grid/product/11.2.0/grid_1)

myserver-> /grid/product/11.2.0/grid/oui/bin/runInstaller -detachHome ORACLE_HOME=/grid/product/11.2.0/grid

Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB.   Actual 4095 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /oracle/oraInventory
'DetachHome' was successful. 

Remove ASM entry from (if it is already there from previous OS template) /etc/oratab

Modify listener.ora file in ${GI_HOME}/network/admin and update hostname.

Ready to clone GI Home

myserver-> cd /grid/product/11.2.0/grid/clone/bin
myserver-> /grid/product/11.2.0/grid/perl/bin/perl clone.pl ORACLE_BASE=/oracle ORACLE_HOME=/grid/product/11.2.0/grid OSDBA_GROUP=dba OSOPER_GROUP=dba ORACLE_HOME_NAME=Ora11g_gridinfrahome1 CRS=TRUE

./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/oracle" "ORACLE_HOME=/grid/product/11.2.0/grid" "oracle_install_OSDBA=dba" "oracle_install_OSOPER=dba" "ORACLE_HOME_NAME=Ora11g_gridinfrahome1" "CRS=TRUE" -silent -noConfig -nowait 
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 4095 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-11-05_08-00-37AM. 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:
 /oracle/oraInventory/logs/cloneActions2013-11-05_08-00-37AM.log
.................................................................................................... 100% Done
.
 
 
Could not backup file /grid/product/11.2.0/grid/rootupgrade.sh to /grid/product/11.2.0/grid/rootupgrade.sh.ouibak
Could not backup file /grid/product/11.2.0/grid/root.sh to /grid/product/11.2.0/grid/root.sh.ouibak
 
Installation in progress (Tuesday, November 5, 2013 8:00:46 AM EST)
........................................................................                             72% Done.
Install successful
 
Linking in progress (Tuesday, November 5, 2013 8:00:48 AM EST)
Link successful
 
Setup in progress (Tuesday, November 5, 2013 8:01:07 AM EST)
.................                                               100% Done.
Setup successful
 
End of install phases.(Tuesday, November 5, 2013 8:01:28 AM EST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
/grid/product/11.2.0/grid/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts
    
Run the script on the local node.
The cloning of Ora11g_gridinfrahome1 was successful.
Please check '/oracle/oraInventory/logs/cloneActions2013-11-05_08-00-37AM.log' for more details.

Following configuration scripts need to be executed as “root” user.

myserver-> /grid/product/11.2.0/grid/root.sh

Check /grid/product/11.2.0/grid/install/root_myserver.mydomain.com_2013-11-05_08-32-20.log for the output of root script

Now configure Oracle GI/HAS

myserver-> /grid/product/11.2.0/grid/perl/bin/perl -I/grid/product/11.2.0/grid/perl/lib -I/grid/product/11.2.0/grid/crs/install /grid/product/11.2.0/grid/crs/install/roothas.pl

Using configuration parameter file: /grid/product/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'dba'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node myserver successfully pinned.
Adding Clusterware entries to upstart
 
myserver     2013/11/05 08:34:12     /grid/product/11.2.0/grid/cdata/myserver/backup_20131105_083412.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

Ready to create ASM instance. Use oracleasm command to scandisks and list the name of disks available to you.

myserver-> oracleasm scandisks
myserver-> oracleasm listdisks

Run the asmca command to create ASM instance and initial diskgroup.  Replace the disk name from the output of oracleasm listdisks command and adjust the AU_SIZE accordingly.

myserver-> cd /grid/product/11.2.0/grid/bin
myserver-> ./asmca -silent -configureASM -sysAsmPassword password -asmsnmpPassword password -diskString 'ORCL:*' -diskGroupName DGDATA01 -diskList 'ORCL:DISK1,ORCL:DISK2,ORCL:DISK3,ORCL:DISK4' -redundancy EXTERNAL -au_size 4 -compatible.asm 11.2 -compatible.rdbms 11.2
 
ASM created and started successfully.
 
Disk Group DG_DATA_01 created successfully.

If you have Huge Pages configured then disable AMM.  Run the following SQL in ASM and restart to disable AMM

alter system set memory_max_target=0 scope=spfile; 
alter system set sga_target=1024M scope=spfile;
alter system set sga_max_size=1024M scope=spfile;

Add listener to CRS

srvctl add listener 
srvctl start listener 
srvctl status listener

Cloning DB Home

Detach Oracle home from inventory – only needed if source ${ORACLE_HOME} is different from target ${ORACLE_HOME}.  If source and destination locations are same and oraInventory was also copied then you can skip detach and clone step.

myserver-> /oracle/product/11.2.0/dbhome_1/oui/bin/runInstaller -detachHome ORACLE_HOME=/oracle/product/11.2.0/dbhome_1
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 4095 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /oracle/oraInventory
'DetachHome' was successful.

Clone Oracle Home

myserver-> cd /oracle/product/11.2.0/dbhome_1/clone/bin
myserver-> /oracle/product/11.2.0/dbhome_1/perl/bin/perl clone.pl ORACLE_BASE=/oracle ORACLE_HOME=/oracle/product/11.2.0/dbhome_1 OSDBA_GROUP=dba OSOPER_GROUP=dba ORACLE_HOME_NAME=OraDb11g_home1
./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/oracle" "ORACLE_HOME=/oracle/product/11.2.0/dbhome_1" 
"oracle_install_OSDBA=dba" "oracle_install_OSOPER=dba" "ORACLE_HOME_NAME=OraDb11g_home1" -silent -noConfig -nowait 
Starting Oracle Universal Installer...
 
Checking swap space: must be greater than 500 MB.   Actual 4095 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-11-05_09-26-43AM. 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:
 /oracle/oraInventory/logs/cloneActions2013-11-05_09-26-43AM.log
.................................................................................................... 100% Done
.
 
Installation in progress (Tuesday, November 5, 2013 9:26:53 AM EST)
..............................................................................               79% Done.
Install successful
 
Linking in progress (Tuesday, November 5, 2013 9:26:58 AM EST)
Link successful
 
Setup in progress (Tuesday, November 5, 2013 9:27:23 AM EST)
Setup successful
 
End of install phases.(Tuesday, November 5, 2013 9:27:46 AM EST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
/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 OraDb11g_home1 was successful.
Please check '/oracle/oraInventory/logs/cloneActions2013-11-05_09-26-43AM.log' for more details.

Run the following as ROOT user:

/oracle/product/11.2.0/dbhome_1/root.sh

All done! 🙂

Ready to create database either using dbca or scripts.

Published inOracle Database 11gR2

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *