Skip to Main Content
  • Questions
  • What ORACLE_HOME was used to start up a database instance?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, David.

Asked: September 22, 2016 - 2:38 pm UTC

Last updated: September 22, 2016 - 3:42 pm UTC

Version: 11.2.0.4

Viewed 10K+ times! This question is

You Asked

For various reasons, patching to name one, we need to know from which ORACLE_HOME a database instance is running. I know that in RAC/Grid Infrastructure that ORACLE_HOME for databases is stored in the Oracle Cluster Registry. What becomes confusing is the situation where I have a server with multiple ORACLE_HOME's and multiple database instances running.
example oracle home directories:
1. $ORACLE_BASE/product/11.1.0
2. $ORACLE_BASE/product/11.2.0
3. $ORACLE_BASE/product/11.2.0.4/db_1
4. $ORACLE_BASE/product/11.2.0.4
example oracle home database instances running:
orcl1110 from 1.
orcl1120 from 2.
orcl112g from 3.
orc2112g from 4.

Is there a metadata view in the Oracle database that picks up and displays the ORACLE_HOME from which the database instance was started?

If not, wouldn't this be a good thing to add to say v$instance?


(this is my first time to post so be gentle)
Respectfully,
David Riskind



and Connor said...

"(this is my first time to post so be gentle)"

hee hee hee

I dont think there is anything *inside* the database which shows this. If you are on a Unix system, you can use OS tools to see what executables are loaded by a process.

A friend Tanel has a little script to make this easy for you

http://blog.tanelpoder.com/2011/02/28/finding-oracle-homes-with/

Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

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.