Set the ORACLE_SID for sqlplus / as sysdba
Issue/Symptom/Question
I need to set my ORACLE_SID to PROD so that I can run sqlplus / as sysdba
Applies To
sqlplus
DBA's
Resolution/Fix/Answer
When you need to do database admin tasks as the / as sysdba user, you must set the ORACLE_SID to the database you wish to work with.
To run sqlplus as the sysdba user you must first log into the linux server as the 'oracle' operating system user.
When you log in as the 'oracle' operating system user, you will be prompted for the ORACLE_SID.
SIDs on this machine are PROD PROD_H TEST TEST_H
ORACLE_SID = [PROD] ?
You can either type in the Database SID or just hit return to take the default, which is PROD. For this example I am taking the default of PROD
NOTE:Â This is case sensitive and must be entered in upper case.
Â
If you wish to verify that you have the correct ORACLE_SID you can type the following at the command prompt.Â
[oracle@dbprod ~]$ echo $ORACLE_SID
PROD
One more way to verify which database you are in is:
[oracle@dbprod ~]$ sqlplus
SQL*Plus: Release 12.1.0.2.0 Production on Fri Jan 3 10:31:45 2020
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL> select name from v$database;
NAME
---------
PROD