HowTo: Move/Clone Grid Home

This blog post is about the steps needed to successfully move or clone the Grid home. In an Oracle database environment using ASM as the filesystem for the database, you would have to first install the Grid Infrastructure(GI) software and then install the Oracle RDBMS Software. Oracle GI Stack provides the Cluster Ready Services (CRS for RAC), Oracle Restart, Oracle High Availability Services(HAS), and ASM. The use of ASM is required in a RAC environment, however you can also install and use ASM in a standalone server configuration.

Since the GI installation is separate from the RDBMS installation, you must create a Grid Home. The Oracle Cluster Services and High Availability Services are connected to the server hostname, which makes moving the Grid home a bit more involved than a RDBMS Oracle Home move/clone.

The steps to move or clone the Grid Home are as follows:

Stop database & ASM Instance

Stop the listener

Backup the old GRID_HOME directory

As a best practice, take a backup before making any changes to your database or host server. You can backup the directory using tar as follows:

tar -zcvf ARCHIVE_NAME.tar.gz DIRECTORY_PATH/NAME

Deconfigure old CRS: #If it applies

$GRID_HOME/crs/install/rootcrs.pl -deconfig -force –verbose

Move Grid Home(directory) using the mv command on NIX-Based servers

Use OUI to clone the Grid Home to the new location

/u01/app/11.2.0/grid_2/oui/bin/runInstaller \

-clone \

-silent \

-defaultHomeName \

ORACLE_HOME=/u01/app/11.2.0/grid_2 \

ORACLE_BASE=/u01/app \

-waitForCompletion

Run root.sh as root/sudo:

/u01/app/11.2.0/grid_2/root.sh

Run the roothas.pl script from grid home using the following syntax to activate Oracle Restart (Must be run as Root/Sudo):

/u01/app/11.2.0/grid_2/perl/bin/perl -I /u01/app/11.2.0/grid_2/perl/lib -I /u01/app/11.2.0/grid_2/crs/install /u01/app/11.2.0/grid_2/crs/install/roothas.pl

Relink the Binaries:

As root:

cd GRID_HOME/crs/install

perl rootcrs.pl -unlock

As the Oracle Grid Infrastructure for a Cluster owner:

export ORACLE_HOME= /path to Grid Home

$GRID_HOME/bin/relink

As root again:

cd GRID_HOME/rdbms/install/

./rootadd_rdbms.sh

cd GRID_HOME/crs/install

perl rootcrs.pl -patch

Reconfigure resources:

/u01/app/11.2.0/grid_2/bin/crsctl config has

/u01/app/11.2.0/grid_2/bin/crsd.bin

crsctl stat res –t

start the resources

Modify the oratab file for the ASM Instance that is using the Grid Home that has been moved because OUI does not update the oratab.

Reset the environment by running

. oraenv

Update the bash profile with the path to the new home

Check oracle inventory to verify the changes

$ORACLE_HOME/OPatch/opatch lsinv –all

You will notice that the old Oracle Home is still registered and that the new Oracle Home has been added by the cloning step.

5.png

 

Then remove the old Oracle Home from Oracle Inventory

You need to use OUI and provide the path to the old Oracle Home as the ORACLE_HOME parameter with -detachHome option:

$ORACLE_HOME/oui/bin/runInstaller \

-silent \

-detachHome \

ORACLE_HOME=/u01/app/product/11.2.0/grid_2 \

-waitForCompletion

Check that old Oracle Home has been removed from Oracle Inventory:

$ORACLE_HOME/OPatch/opatch lsinv –all

If the command above lists only the new Grid home, your clone has been successful thus far, the best practice would be to confirm that every works/functions as expected prior to starting the database. So, it is important to first validate and test the services.

If there are no issues or red flags, then move on:

Start the listener using srvctl

Go to asmcmd and mount the diskgroups

Start the ASM Instance & Database

*Cover Image from starwars.wikia.com