Several Options for Finding ORACLE_HOME
David Riskind, September 22, 2016 - 4:18 pm UTC
While awaiting the answer I came across an article from Stackexchange:
http://dba.stackexchange.com/questions/97390/query-to-get-oracle-home-path-in-oracle-11g , that describes a couple other methods for getting ORACLE_HOME;
SQL> select sys_context('USERENV','ORACLE_HOME') from dual;
and
SQL> var oracle_home clob;
SQL> exec dbms_system.get_env('ORACLE_HOME', :oracle_home);
PL/SQL procedure successfully completed.
SQL> print oracle_home
both contributed by readers of that forum.
I must say, I like Tanel's approach even better especially for shell scripting in that I do not have to logon to the database instance to find the answer.
clarification
David Riskind, September 22, 2016 - 5:29 pm UTC
the statement:
SQL> select sys_context('USERENV', 'ORACLE_HOME') from dual;
only applies to oracle 12c.
Finding a database home of a RAC database.
Venky, February 15, 2018 - 5:59 am UTC
crsctl stat res -t provides the list of databases which are ONLINE and OFFLINE.
Find the database homes for the list of databases using
srvctl config database -d databasename
which will provide the database home for the particular database listed.