Wednesday, April 30, 2014

How to Clone Oracle Grid Infrastructure / Restart and database

Following instruction can be used to clone Oracle GI Restart from 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.

 Cloning GI Home

ROOT tasks (only needed if HAS was already configured)

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

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
 
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

ORACLE tasks

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)
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 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 the "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

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

Now 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 and 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 DG_DATA_01 -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_target=0 scope=spfile; 
alter system set memory_max_target=0 scope=spfile; 
alter system set sga_target=272M scope=spfile;

Add listener to CRS
srvctl add listener 
srvctl start listener 
srvctl status listener

Cloning DB Home


Detach Oracle home from inventory

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
Ready to create database either using dbca or scripts.

No comments:

Post a Comment