Finding Oracle Home

September 6th, 2013


business vision

Once in while I work on systems that are new to me and no one is around to explain the configuration to me. I can see databases running and their SIDs via the process names, but when there are multiple ORACLE_HOME directories possible it can be difficult to even connect to these databases because connecting locally requires the SID and ORACLE_HOME. In these cases, I’ve often wanted a way to clearly figure out which running database is using which ORACLE_HOME, so it was fun to see Tanel Poder’s recent posted on how to do this on LINUX and SOLARIS. Here is a quick summary of LINUX and SOLARIS plus HPUX and AIX as well:

Solaris and Linux

$ pgrep  -lf _pmon_
12586 ora_pmon_ee10204

ORACLE_SID is ee10204

$ pwdx 12586
12586: /u01/oracle/10.2.0.4/ee1/dbs

ORACLE_HOME is /u01/oracle/10.2.0.4/ee1
HPUX
$ ps -ef | grep pmon
ora1024 25611     1  0  Mar 21  ?         0:24 ora_pmon_itanic10

ORACLE_SID is itanic10

$ pfiles 25611 | grep  bin
25611:                  /opt/ora1024/app/db_1/bin/oracle

ORACLE_HOME is /opt/ora1024/app/db_1

AIX

$ ps -ef | grep pmon
ora1024   262314        1   0   Mar 23      -  0:12 ora_pmon_mercury

ORACLE_SID is mercury

$ ls -l /proc/262314/cwd
lr-x------   2 ora1024  dba  0 Mar 23 19:31 cwd -> /data/opt/app/product/10.2.0.4/db_1/dbs/

ORACLE_HOME is /data/opt/app/product/10.2.0.4/db_1

MP910216359


Uncategorized

  1. Trackbacks

  2. No trackbacks yet.
  1. Comments

  2. khailey
    | #1

    Nice trick from Wissem El Khlifi ‏@orawiss on twitter:
    @kylehhailey thanks Kyle for sharing:) you can also use dbms_system.get_env(‘ORACLE_HOME’, :OHM) ; from the DB

    SQL > var OH varchar2(200);
    SQL > EXEC dbms_system.get_env(‘ORACLE_HOME’, :OH) ;
    SQL > PRINT OH

  3. Francois G
    | #2

    This is hoppefully far more simple on windows system since you just have to check the regedit.

  4. | #3

    Hello Kyle,

    AFAIK, under AIX there are proc tools too (although there seems to be a little less tools than on Solaris). In this case, I think you can use the procwdx command on AIX to act the very same way as pwdx on Solaris does.


    Best regards,
    Julien Gabel.

  5. Per Johnsson
    | #4

    Hello,

    Very good article. I have a suggestion an addition and a question:
    On Linux I use the same method as you do on AIX

    ls -l /proc/$PID/cwd

    I do this since not all Linuxes have pwdx.

    You can do this for windows also:
    wmic process where name=’oracle.exe’ get commandline
    CommandLine
    c:\oracle\product\11.2.0\dbhome_1\bin\ORACLE.EXE ORCL

    ORACLE_SID = ORCL
    ORACLE_HOME=c:\oracle\product\11.2.0\dbhome_1

    For HP-UX I see that you use pfiles. I think this is new for HP-UX 11i v3. Is it possible to do the same on older HP-UX releases?

    Best regards,

    /Per


7 + = sixteen