Step 2: Set Operating System Environment Variables
Depending on your platform, you may have to set environment variables before starting SQL*Plus, or at least verify that they are set properly.
For example, on most platforms, you must set the environment variables
ORACLE_SID and ORACLE_HOME. In addition, you
must configure the PATH environment variable to include the
ORACLE_HOME/bin directory. Some platforms may require
additional environment variables:
-
On Unix and Linux, set environment variables by entering operating system commands as needed.
-
On Microsoft Windows, the installer automatically assigns values to
ORACLE_HOMEandORACLE_SIDin the Windows registry. Modify the LD_LIBRARY_PATH
If you did not create a database upon installation, then the installer
does not set ORACLE_SID in the registry; after you create your
database at a later time, you must set the ORACLE_SID environment
variable from a command window.
Unix and Linux installations come with two scripts,
oraenv and coraenv, that you can use to easily
set environment
variables.
For all platforms, when switching between instances with different Oracle
homes, you must change the ORACLE_HOME environment variable. If
multiple instances share the same Oracle home, then you must change only
ORACLE_SID when switching instances.
Example 4-1 Setting Environment Variables in Unix (C Shell)
setenv ORACLE_SID orcl
setenv ORACLE_HOME /u01/app/oracle/product/database_release_number/dbhome_1
setenv LD_LIBRARY_PATH $ORACLE_HOME/lib:/usr/lib:/usr/dt/lib:/usr/openwin/lib:/usr/ccs/libExample 4-2 Setting Environment Variables in Linux (Bash Shell)
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/database_release_number/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/dt/lib:/usr/openwin/lib:/usr/ccs/libExample 4-3 Setting Environment Variables in Microsoft Windows
SET ORACLE_SID=orawin2 setenv LD_LIBRARY_PATH $ORACLE_HOME/lib:/usr/lib:/usr/dt/lib:/usr/openwin/lib:/usr/ccs/lib:$LD_LIBRARY_PATH
This Microsoft Windows example assumes that ORACLE_HOME and
ORACLE_SID are set in the registry, but that you want to
override the registry value of ORACLE_SID to connect to a different
instance.
On Microsoft Windows, environment variable values that you set in a command prompt window override the values in the registry.
Parent topic: Connecting to the Database with SQL*Plus