Setting environment variables outside the profile registries on Linux and UNIX operating systems
On Linux® and UNIX operating systems, you must set the DB2INSTANCE system environment variable outside the profile registries. If you want to set any other variables, those variables must be set in one or more of the profile registries.
About this task
You can use the scripts db2profile (for Bourne or Korn shell) and db2cshrc (for C shell) to set the DB2INSTANCE variable to an instance name that you specify. The scripts are in the instance_home/sqllib directory, where instance_home is the home directory of the instance owner.
Instance owners and users with SYSADM privileges can customize these scripts for all users of an instance. Alternatively, users can copy and customize a script, then invoke a script directly or add it to their .profile or .login files.
To set variables that are not supported by the Db2® database manager, define them in the userprofile and usercshrc script files. These files are also in the instance_home/sqllib directory.
Procedure
To set an environment variable outside the profile registries:
Option | Description |
---|---|
Set the environment variable at the instance level for a Bourne or Korn shell. | Run the db2profile script. |
Set the environment variable at the instance level for a C shell. | Run the db2cshrc script. |
Set the environment variable for the current session for a Bourne shell. | Issue the following command:
|
Set the environment variable for the current session for a C shell. | Issue the following command:
|
Set the environment variable for the current session for a Korn shell. | Issue the following command:
|