Showing posts with label General Database Questions. Show all posts
Showing posts with label General Database Questions. Show all posts

How to find the sid of oracle database?

General Database Questions
Following are the different ways to find the SID of ORACLE database.

1. Without connecting to database 

WINDOWS:

If Environment Variables are set, then use below command in windows command prompt.

echo %ORACLE_SID%

If Environment Variables are not set, then you can check the window's service for a service named OracleService<sid_name>. 

UNIX/LINUX:

If Environment Variables are set, then use below command in command line.

echo $ORACLE_SID

If Environment Variables are not set, then you can check the /var/opt/oracle/oratab file on UNIX and the /etc/oratab file on LINUX.

2. After connecting to database

Connect with SYS or SYSTEM user. Execute any following SQL statement to find the ORACLE_SID
  • SHOW PARAMETER INSTANCE_NAME 
  • SELECT INSTANCE FROM V$THREAD; 
  • SELECT SYS_CONTEXT('USERENV','INSTANCE_NAME') FROM DUAL; 
Find the sid of oracle database
How to find the sid of oracle database