Environment Variables Reference for Linux

Previous
Previous
Next
Next

This section provides reference information for setting environment variables on Linux for the following two scenarios:

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

Remote, using Oracle Database XE Client


ORACLE_HOME
PATH
NLS_LANG
LD_LIBRARY_PATH
SQLPATH

Environment Variable Descriptions and Values for Linux

Variable Name Description Required Value

ORACLE_SID

Oracle Instance ID

XE

ORACLE_HOME

Oracle home directory

For local connection:

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

For remote connection with Oracle Database XE Client:

/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

PATH

Search path for executables. (Must add $ORACLE_HOME/bin to the path.)

For Bourne, Korn, or Bash shell: $ORACLE_HOME/bin:$PATH

For C shell: $ORACLE_HOME/bin:${PATH}

NLS_LANG

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 AMERICAN_AMERICA.US7ASCII

LD_LIBRARY_PATH

Search path for shared libraries. (Must add $ORACLE_HOME/lib to the path.

$ORACLE_HOME/lib:$LD_LIBRARY_PATH

SQLPATH

Search path used by SQL Command Line (SQL*Plus) for *.sql scripts. Contains a colon-separated list of paths. Must include the location of the site profile script, glogin.sql.

$ORACLE_HOME/sqlplus/admin


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

Environment Variable Scripts

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