Also see my notes on
When the oraenv script is run, it reads the oratab filefound in /etc to determine where the Oracle home for a
given database is located. The oratab file contains entries in
the form of ORACLE_SID:ORACLE_HOME:Y, the last character being a Y
or N indicating if the database should be started and stopped with
the dbstart and dbstop commands, respectively. Here is a typical
Lines beginning with a pound sign (#) in the oratab file are
comments. Valid entries are typically found at the end of the
The oratab file can be edited manually using vi or another text
editor. This is often necessary if you the ORACLE_HOMEof a database should be changed.
WARNING: Never set ORACLE_HOME and ORACLE_BASE
Under certain circumstances, it is useful to add an entry to
the oratab file that does not refer to a database. This can allow
setting the necessary variables for Oracle without having a
database associated with the session. To do that, follow the
format mentioned above to add an entry, making sure to set the
last character to N so the dbstart/stop commands do not attempt to
start a database that is not there. This script shows an oratab
entry not associated with a database.
A dummy oratab entry like this can be useful on a system that
does not yet have a database configured on it or on an Oracle
Application Server or a Client install where there may never be a
The oratab filetypically
contains an entry for each database, but in the current
configuration, there is no database set up. To use the
oraenv script, set up a dummy entry in the oratab file.
The oratab file can be edited by the oracle user using vi or
another text editor. Each line in the oratab file has
three elements separated by colons. The first element is
the SID, the second indicates the Oracle Home directory for that
SID, and the third indicates if the database should be started
and stopped by the dbstart/dbshut commands.
Edit the oratab file and add the following line:
Though a database does not exist by the name db_11g, this
entry allows us to setting up the environment for this home
without having to set several variables manually. Make
sure the final element is set to N so Oracle does not attempt to
start a database that is not there.
With an entry now in the oratab file, use the oraenv command
to set up our environment. To do that, run .oraenv which
causes the oraenv script to be run as part of the current shell
rather than as a subprogram.
ORACLE_SID = [oracle] - db_11g
The Oracle base
for ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 is
$ echo $ORACLE_SID
$ echo $ORACLE_HOME
$ echo $PATH