IBM Books

Quick Beginnings for DB2 Extended Enterprise Edition for UNIX


Setting the Operating Environment for Each Instance User

Before users can use DB2, the database environment for each user must be updated so that it can access an instance and run the DB2 programs. This applies to all users (including administrative users).

The sample scripts, db2profile (for Bourne or Korn shell) and db2cshrc (for C shell), are provided to help you set the database environment. These scripts are available in the INSTHOME/sqllib directory, where INSTHOME is the home directory of the instance owner.

These scripts are also required when the db2start and the db2stop commands are run to start or stop the DB2 Extended Enterprise Edition database manager.

The instance owner (or any user that belongs to the instance's SYSADM group) can customize the script for all users of an instance. Alternatively, the script can be copied and customized for each user.

Figure hint not displayed.

The sample script contains statements to:

  • Update a user's PATH by adding the following directories to the existing search path:
       INSTHOME/sqllib/bin
       INSTHOME/sqllib/adm
       INSTHOME/sqllib/misc
    

    where INSTHOME is the home directory of the instance.

  • Set the DB2INSTANCE environment variable to the instance name.

 

Setting the DB2 Environment Automatically

By default, the scripts affect the user environment for the duration of the current session only. You can change the .profile file to enable it to run the db2profile script automatically when the user logs on using the Bourne or Korn shell. For users of the C shell, you can change the .login file to enable it to run the db2cshrc script file.

Add one of the following statements to the .profile or .login script files.

Setting the DB2 Environment Manually

To choose which instance that you want to use, enter one of the following statements at a command prompt. The period (.) and the space are required.

If you want to work with more than one instance at the same time, run the script for each instance that you want to use in separate windows. For example, assume that you have two instances called test and prod, and their home directories are /u/test and /u/prod.

In window 1:

In window 2:

Use window 1 to work with the test instance and window 2 to work with the prod instance.

Figure hint not displayed.

Issue the which db2 command to ensure that your search path has been set up correctly. This command returns the absolute path of the DB2 CLP executable. Verify that it is located under the instance's sqllib directory.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]