How to find Grid Home Location in Oracle ?

Working on Real Application Cluster has become an integral part for a remote DBA. Since, RAC mainly provide high availability and load balancing and this is the reason all organizations are moving towards this technology, Here DBA plays a main role to setup and maintain Real Application Cluster databases.

Here, I am discussing a simple scenario, when you got a RAC installed system, but don't know path of GRID_HOME. Let's find out how to get path of GRID_HOME.

1. When Cluster is up and running: When Cluster ware is up and running then it becomes easy for a remote DBA to find out the GRID_HOME path using below query.

login to system using either root, oracle or gird user and execute.

-bash-4.1$ ps -ef | grep d.bin

  oracle   1515      1   0   Mar 30 ?         173:36 /u01/app/
  oracle   1202      1   0   Mar 30 ?          82:25 /u01/app/
    root    892      1   0   Mar 30 ?          46:00 /u01/app/ reboot
  oracle   1011      1   0   Mar 30 ?           0:36 /u01/app/
  oracle    994      1   0   Mar 30 ?          56:48 /u01/app/
    root   1200      1   0   Mar 30 ?          18:36 /u01/app/
    root   1181      1   0   Mar 30 ?          17:51 /u01/app/
  oracle   1080      1   0   Mar 30 ?           8:53 /u01/app/
  oracle   1115      1   0   Mar 30 ?          91:02 /u01/app/
    root   1147      1   0   Mar 30 ?         295:00 /u01/app/
    root   1478      1   0   Mar 30 ?         173:46 /u01/app/ reboot
    root   1112      1   0   Mar 30 ?          21:00 /u01/app/
    root   2202      1   0   Mar 30 ?         416:31 /u01/app/
  oracle   2167      1   0   Mar 30 ?         144:26 /u01/app/

 I have listed few of the process only, From the above list you can easily see "/u01/app/" is GRID_HOME on this system. Set GRID_HOME and ready for remote DBA activities.

-bash-4.1$ export GRID_HOME=/u01/app/
-bash-4.1$ cd $GRID_HOME/bin

2. When Cluster is not up and Running: What if Cluster is not up and running. In this case, we need to check few locations for GRID_HOME location.

Check Profile or bash_profile File:

Let's start from .profile (Solaris) or .bash_profile (Linux) file. Usually, Oracle environment variables like ORACLE_HOME and GRID_HOME and defined by remote DBA's in to these files using either oracle or grid user. To find GRID_HOME go to home path using

-bash-4.1$ cd ~
-bash-4.1$ ls -a
.                                           dbs_group                                  
..                                          dbs_ib_group                               

In Solaris there is .profile and in Linux this will be .bash_profile file. Cat these files, you might get GRID_HOME variable defined in these files.

-bash-4.1$ cat .profile
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

In this case, GRID_HOME is not defined in profile file. Let's look at other options.

Check oratab file:

oratab file is another file, where home_name with database instances are registered, when any database or ASM instance is created it's name with Home Name are registered  in oratab file. Let's see if it helps.

In Linux path is "/etc/oratab" in Solaris "/var/opt/oracle/oratab"

-bash-4.1$ cat /var/opt/oracle/oratab
# This file is used by ORACLE utilities.  It is created by
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
# Entries are of the form:
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
# Multiple entries with the same $ORACLE_SID are not allowed.
+ASM1:/u01/app/          # line added by Agent
db001:/u01/app/oracle/product/               # line added by Agent

Here, we can see /u01/app/ is path for GRID_HOME. Now, we are good to go with this.

Ora Inventory Location:

When, above also not work, a remote DBA can look into oraInventory location for installation logs. This is the location, where logs are created at time of Oracle S/W installations.  So, we can find out GRID_HOME path in logs.

 In Linux path is "/etc/oraInst.loc" in Solaris "/var/opt/oracle/oraInst.loc"

-bash-4.1$ cat /var/opt/oracle/oraInst.loc
-bash-4.1$ cd /u01/app/oraInventory
-bash-4.1$ ls
backup          ContentsXML     logs            oraInst.loc  oui
-bash-4.1$ cd logs/
-bash-4.1$ ls *out*
oraInstall2013-03-12_01-49-41PM.out            oraInstall2013-03-12_02-45-12PM.out            oraInstall2013-03-12_02-47-32PM.out             oraInstall2013-03-12_01-49-41PM.out.db08  oraInstall2013-03-12_02-45-12PM.out.db08 

Now, execute a grep command for grid on these scrips. like below

-bash-4.1$ cat oraInstall2013-03-12_01-49-41PM.out | grep grid
        2. /u01/app/
Execute /u01/app/ on the following nodes:
        1. /u01/app/

Here is GRID_HOME path to work for. To know, How to find out ORACLE_HOME path visit

Please share your views about this article.

1 comment: