Find out home directory of running Oracle instance

6,155

There are several way to find it out. Some of them:

1) The easiest is to find out with which user the database process are running, then watch if this user has some environment variables set:

$ ps aux | grep ora_pmon
orauser    2653  (...)  ora_pmon_DB

$ su - orauser -c "echo \$ORACLE_HOME"
/u21/oracle/product

2) You may also have an /etc/oratab. If the databases are started automatically on boot, this file may contain the $ORACLE_HOME.

3) You can pick one oracle process and find out its environment:

$ ps aux | grep ora_pmon
orauser    2653  (...)  ora_pmon_DB

$ strings /proc/2653/environ | grep ORACLE_HOME
/u21/oracle/product

Note that /proc/2653/environ has a specific delimiter (shown as ^@)

4) If you have an access to the database, using sqlplus, you can try this trick:

SQL> @?/foobar.foo

WATCHOUT!foobar.foo should not exist, so you will have an error message like /u21/oracle/product/foobar.sql doesn't exist

Share:
6,155

Related videos on Youtube

Harold L. Brown
Author by

Harold L. Brown

Updated on September 18, 2022

Comments

  • Harold L. Brown
    Harold L. Brown almost 2 years

    There are two oracle directories on our system:

    • oracle
    • oraclex

    How can I find out which of them is used by the running Oracle instance?