15 January, 2013

Get Oracle Home & Oracle SID from PLSQL

The below script gets Oracle Home and Oracle SID from PL/SQL

 DECLARE  
   LC$ORACLE_HOME  VARCHAR2 (2000);  
   LC$ORACLE_SID  VARCHAR2 (256);  
 BEGIN  
   DBMS_SYSTEM.GET_ENV ('ORACLE_HOME', LC$ORACLE_HOME);  
   DBMS_SYSTEM.GET_ENV ('ORACLE_SID', LC$ORACLE_SID);  
   
   -- Oracle Home  
   DBMS_OUTPUT.PUT_LINE ('ORACLE_HOME = ' || LC$ORACLE_HOME);  
   
   -- Oracle SID  
   DBMS_OUTPUT.PUT_LINE ('ORACLE_HOME = ' || LC$ORACLE_SID);  
 END;  

Thanks
Recommended Post Slide Out For Blogger