Oracle environment variables
There are required and optional environment variables for Oracle data sources. These variables are set in the db2dj.ini file.
- DB2LIBPATH
- ORACLE_HOME
- ORACLE_BASE (optional)
- ORA_NLS (optional)
- NLS_LANG (optional)
- TNS_ADMIN (optional)
Variable descriptions
- DB2LIBPATH
- DB2LIBPATH is required by Federation when Oracle wrapper is used. Specifies the environment
variable to the directory path where the Oracle client library is located. Specify the fully
qualified path for the environment variable:
It must be contracted as $ORACLE_HOME/lib for the federation server. Otherwise it will return aDB2LIBPATH=oracle_home_directory/lib
SQL30090N
when issuing a create wrapper statement. If it does not exist or the Oracle libraries are not placed in it, create this directory and copy the libraries to it or make a link from the actual path of the libraries to this directory.For example, if the Oracle home directory is /usr/oracle/8.1.7, specify the following value for the DB2LIBPATH environment variable in the db2dj.ini file:DB2LIBPATH=/usr/oracle/8.1.7/lib
This variable will be overridden by setting the DB2LIBPATH db2set variable, and will override the setting by the EXPORT command. The value that is set for this variable in db2dj.ini file will be used after Db2® upgrade.
- ORACLE_HOME
-
Set the ORACLE_HOME environment variable to the directory path where the Oracle client software is installed. Specify the fully qualified path for the environment variable: ORACLE_HOME=oracle_home_directory. For example, if the Oracle home directory is \usr\oracle\8.1.7, the entry in the db2dj.ini file is
ORACLE_HOME=\usr\oracle\8.1.7
.If an individual user of the federated instance sets the ORACLE_HOME environment variable locally, the federated instance does not use that setting. The federated instance uses only the value of ORACLE_HOME that is set in the db2dj.ini file.
- ORACLE_BASE
-
ORACLE_BASE represents the root of the Oracle client directory tree. If you set the ORACLE_BASE environment variable when you installed the Oracle client software, set the ORACLE_BASE environment variable on the federated server.
For example:
ORACLE_BASE=oracle_root_directory
- ORA_NLS
- If multiple versions of Oracle are running on your system, you must ensure
that:
- The appropriate ORA_NLS environment variable is set
- The corresponding NLS data files for the versions that you are using are available
The location-specific data is stored in a directory that is specified by the ORA_NLS environment variable. Each version of Oracle has a different ORA_NLS data directory.Table 1. ORA_NLS environment variable by version Oracle version Environment variable 8.x, 9.x ORA_NLS33 10.x ORA_NLS10 For example, on federated servers that run UNIX that access Oracle 8.1 data sources, the ORA_NLS33 environment variable setting is:
ORA_NLS33=oracle_home_directory/ocommon/nls/admin/<data>
- NLS_LANG
- The NLS_LANG environment variable is a code page environment variable. Refer to the Oracle NLS documentation for information about setting this variable.
- TNS_ADMIN
- On federated servers that run Windows
- The Oracle client looks for the tnsnames.ora file
in the %ORACLE_HOME%\NETWORK\ADMIN directory, where
%ORACLE_HOME%
is defined in the db2dj.ini file. If the tnsnames.ora file is not in the %ORACLE_HOME%\NETWORK\ADMIN directory, you must set the TNS_ADMIN environment variable in the db2dj.ini file on the federated server. You set the environment variable in the db2dj.ini file to the path where the tnsnames.ora file is located. - On federated servers that run AIX® or Linux®
- The Oracle client looks for the tnsnames.ora file
in the /etc directory. If the tnsnames.ora file
is not in the /etc directory, then the Oracle client
looks for the tnsnames.ora file in the $ORACLE_HOME/network/admin directory,
where
$ORACLE_HOME
is defined in db2dj.ini file. If the tnsnames.ora file is not in the $ORACLE_HOME/network/admin directory, you must set the TNS_ADMIN environment variable on the federated server. You set the environment variable in the db2dj.ini file to the path where the tnsnames.ora file is located.For example, if the tnsnames.ora file is in the /home/oracle directory, you set the environment variable to:TNS_ADMIN=/home/oracle