Creating and configuring a database for DB2 UDB 7.2

This article describes how to do the following:

The procedures in this article assume that DB2 is installed in the default location /opt/IBMdb2/V7.2 and that any required FixPak is installed.

Creating a database instance

  1. Ensure that you are logged into the machine with superuser (root) privileges.
  2. Use the HP-UX System Administration Manager (SAM) to create an administrative group for DB2 named db2adm.
  3. Create a user ID to be the DB2 instance owner and name it, for example, db2inst1. Specify db2adm as the group for db2inst1. For the steps in this section, use a password such as ibmdb2. Note that DB2 requires a password of 8 or fewer characters. Specify a home directory of, for example, /home/db2inst1.
  4. Add db2inst1 and root to the db2adm group.
  5. Create a database instance by entering the following at a command prompt:
    # /opt/IBMdb2/V7.2/instance/db2icrt -u db2inst1 db2inst1
  6. Create symbolic links:
    # /opt/IBMdb2/V7.2/cfg/db2ln
  7. Optionally, install the sample database. As root, set the environment variable DB2INSTANCE to db2inst1, then run:
    # /opt/IBMdb2/V7.2/samples/db2sampl
  8. Configure the db2inst1 account to run db2profile on startup. For ksh, add the line below to the instance owner .profile. Note the space between the period (.) and the first forward slash (/).
    . /opt/IBMdb2/V7.2/sqllib/db2profile

    For csh, add the following line to the .cshrc of the instance owner:

    source /opt/IBMdb2/V7.2/sqllib/db2cshrc
  9. Configure root to run the db2profile on startup. This is required to install and run WebSphere Application Server. For sh or ksh, add the following line to the .profile or .dtprofile file for root:
    . /opt/IBMdb2/V7.2/sqllib/db2profile
  10. As user db2inst1, run db2start to start DB2.

Configuring a database for the administrative configuration

Because this is the first installation, create a database to store the configuration. The was database will be defined by its JDBC URL as jdbc:db2:was. Create the was database and set its DB2 application heap size by entering the command:

$ db2 create database was

When the database is created, enter the command below to set the application heap size:

$ db2 update db config for WAS using applheapsz 256

If an application heap size of 256 doesn't work for your system, increase the size to, for example, 512.

To verify the connection to the was database, log in as db2inst1. If DB2 is not already running, enter the command db2start. Then, when DB2 is running, enter the command:

$ db2 connect to was