2 Day DBA > Connecting to the Database > Environment Variables Refer...
Environment Variables Reference for Linux |
Previous |
Next |
This section provides reference information for setting environment variables on Linux for the following two scenarios:
Connecting locally
Connecting remotely from Oracle Database XE Client.
Table: Required Linux Environment Variables for Connecting with Oracle Utilities lists the environment variables that you must set for each of these scenarios. Table: Environment Variable Descriptions and Values for Linux provides environment variable descriptions and required values.
Required Linux Environment Variables for Connecting with Oracle Utilities
Connection Type | Required Environment Variables |
---|---|
Local |
ORACLE_SID ORACLE_HOME PATH NLS_LANG LD_LIBRARY_PATH |
ORACLE_HOME PATH NLS_LANG LD_LIBRARY_PATH SQLPATH |
Environment Variable Descriptions and Values for Linux
Variable Name | Description | Required Value |
---|---|---|
Oracle Instance ID |
|
|
Oracle home directory |
For local connection:
For remote connection with Oracle Database XE Client:
|
|
Search path for executables. (Must add |
For Bourne, Korn, or Bash shell: For C shell: |
|
Locale (language and territory used by client applications and the database; character set used by client applications) |
(The desired language, territory, and character set. See Oracle Database Express Edition Installation Guide for Linux for details.) Defaults to |
|
Search path for shared libraries. (Must add |
|
|
Search path used by SQL Command Line (SQL*Plus) for |
|
Example
The following are the Bash shell commands that set the required environment variables for a local connection on a Linux installation in the United States:
ORACLE_SID=XE;export ORACLE_SID ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server;export ORACLE_HOME PATH=$ORACLE_HOME/bin:$PATH;export PATH NLS_LANG=AMERICAN_AMERICA.AL32UTF8;export NLS_LANG LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH;export LD_LIBRARY_PATH
Oracle Database XE and Oracle Database XE Client ship with two shell scripts that you can use to easily set environment variables. The scripts are located in $ORACLE_HOME/bin
and are named as follows:
oracle_env.sh
(for Bourne, Korn, or Bash shell)oracle_env.csh
(for C shell)You can invoke these scripts from within dot files so that environment variables are set automatically each time that you start a new terminal session (start a new shell). The following is an example of a command that you can add to the .cshrc
file in your home directory:
source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.csh