Below are the steps to connect to an Oracle database. These can be helpful to the people who are new to the Oracle world.
1. Login to unix user which has the permissions to connect to database. Most of the times it is with the name Oracle but it may vary from one installation to other. This unix user is part of the dba group for administrator actions and oinstall group to manage the software (install, software patching etc.).
2. Ensure your environment variables are set properly. Below are the environment variables and their description that should be set:
ORACLE_HOME - Location to the Oracle database software.
ORACLE_SID - Name of the Oracle Instance to connect. Database name can be different that of the instance. This is the case in ORACLE RAC environment.
PATH - PATH environment should be modified to also include the location of Oracle binaries like sqlplus, lsnrctl etc.
For example if your database name is TEST and location of the Oracle software is /home/oracle/product/11.2.0.2/
export ORACLE_SID=TEST
export ORACLE_HOME=/home/oracle/product/11.2.0.2/
export PATH=$PATH:$ORACLE_HOME/bin
In order to permanently store the settings of above variables, it is recommended to save these in profile file of the user.
3. Running Oracle instances on a server can be identified using "ps" command in unix. (ps -ef | grep pmon)
4. login to sqlplus with sysdba privileges. - on unix command prompt type: sqlplus / as sysdba
5. Check the database details. On SQL prompt type the below query:
select name,open_mode from v$database;
Startup a database if it is down.
Connect to sqlplus as sysdba.
SQL>startup
Shutdown the Oracle database. - DO NOT USE THIS COMMAND UNTIL NOT REQUIRED. THIS IS ALWAYS DONE DURING PLANNED MAINTENANCE WINDOWS. ALWAYS INFORM USERS ABOUT THE DOWNTIME.
Connect to sqlplus as sysdba.
SQL>shutdown
1. Login to unix user which has the permissions to connect to database. Most of the times it is with the name Oracle but it may vary from one installation to other. This unix user is part of the dba group for administrator actions and oinstall group to manage the software (install, software patching etc.).
2. Ensure your environment variables are set properly. Below are the environment variables and their description that should be set:
ORACLE_HOME - Location to the Oracle database software.
ORACLE_SID - Name of the Oracle Instance to connect. Database name can be different that of the instance. This is the case in ORACLE RAC environment.
PATH - PATH environment should be modified to also include the location of Oracle binaries like sqlplus, lsnrctl etc.
For example if your database name is TEST and location of the Oracle software is /home/oracle/product/11.2.0.2/
export ORACLE_SID=TEST
export ORACLE_HOME=/home/oracle/product/11.2.0.2/
export PATH=$PATH:$ORACLE_HOME/bin
In order to permanently store the settings of above variables, it is recommended to save these in profile file of the user.
3. Running Oracle instances on a server can be identified using "ps" command in unix. (ps -ef | grep pmon)
4. login to sqlplus with sysdba privileges. - on unix command prompt type: sqlplus / as sysdba
5. Check the database details. On SQL prompt type the below query:
select name,open_mode from v$database;
Startup a database if it is down.
Connect to sqlplus as sysdba.
SQL>startup
Shutdown the Oracle database. - DO NOT USE THIS COMMAND UNTIL NOT REQUIRED. THIS IS ALWAYS DONE DURING PLANNED MAINTENANCE WINDOWS. ALWAYS INFORM USERS ABOUT THE DOWNTIME.
Connect to sqlplus as sysdba.
SQL>shutdown
Comments
Post a Comment