Print Friendly, PDF & Email

 
REQUEST

I want to get the ORACLE_HOME path by querying the database.

 
RELATED

 
SOLUTION

 

DBMS_SYSTEM

COL ORACLE_HOME FOR A30
VARIABLE ORACLE_HOME VARCHAR2(100);
EXEC DBMS_SYSTEM.GET_ENV('ORACLE_HOME',:ORACLE_HOME);
PRINT ORACLE_HOME

ORACLE_HOME
------------------------------
/oracle/product/12.2.0.1

 

DBA_LIBRARIES

COL "ORACLE_HOME" FOR A30
SELECT NVL(SUBSTR(FILE_SPEC, 1, INSTR(FILE_SPEC, '\', -1, 2) -1), 
       SUBSTR(FILE_SPEC, 1, INSTR(FILE_SPEC, '/', -1, 2) -1)) "ORACLE_HOME"
FROM DBA_LIBRARIES WHERE  LIBRARY_NAME = 'DBMS_SUMADV_LIB';

ORACLE_HOME
------------------------------
/oracle/product/12.2.0.1

 

SYS_CONTEXT

-- 12c only

SELECT SYS_CONTEXT ('USERENV','ORACLE_HOME') ORACLE_HOME FROM DUAL;

ORACLE_HOME
------------------------------
/oracle/product/12.2.0.1

 
 

Version  : 15:33 19.01.2018
Database : Oracle database 10g – 12cR2