Monday, September 10, 2007

How to find the ORACLE_HOME path in Oracle Database?

In 9i:

SELECT substr(file_spec,1,instr(file_spec,'lib')-2) ORACLE_HOME FROM dba_libraries
WHERE library_name='DBMS_SUMADV_LIB';

In 10g:

SQL > var OHM varchar2(100);
SQL > EXEC dbms_system.get_env('ORACLE_HOME', :OHM) ;
SQL > PRINT OHM

Linux/Unix:

echo $ORACLE_HOME

Windows:

start - run - regedit (enter) - HKEY_LOCAL_MACHINE - SOFTWARE - ORACLE

Type the below command at prompt if the environment variable is defined for ORACLE_HOME

c:\> set oracle_home (ENTER)

Update: Take a look at my other post on "Setting an Oracle Environment variable – ORACLE_HOME"

5 comments:

Anjani Kumar Saxena said...

Bhai,

If u give ps -ef |grep tns

then tns entry details also shows full path of oracle home.

becoz if env is not set then echo$ORACLE_HOME does not work.

Regards,
Anjani Kumar

Venkatesh from INDIA said...

What happen when i try that regedit, If some thing badly i cont able to solve , bcoz i dont have idea about regedit, so please explain before what happen

venki

Sabdar Syed said...

Read about registry in the following URL.

http://www.databasejournal.com/features/oracle/article.php/3373301

Regards,
Sabdar Syed

Mediamax said...

Anjani,

That ps command of yours was very useful in finding out the actual Oracle version (from among multiple Oracle installations & Home Dirs) being run in our server..Something which I couldnt find even after googling for quite sometime..

Thanks a lot !

Sandeep.

Nith said...

minsemHey, thanks. I have a couple of Oracle homes and on long run I forgot which database belongs to which one. This is the only method that worked for me in finding the Oracle Home. Thanks a lot!