Creating a DB2 database on UNIX platforms

Start of changeWhen you create a broker, you specify the user ID and password that are used to connect to the database. The user ID must be known to the database and must own the tables that are being accessed. When you create the database, ensure that you create them for the right user ID. DB2 authenticates the user ID using operating system user management, you do not have to define the user ID to DB2 itself.End of change

When you create a DB2 database on a UNIX platform, you must complete setup tasks before you create the database. You are recommended to do this after you have installed DB2, but you can complete this process beforehand if you specify the intended DB2 installation directory correctly during this setup.

  1. Invoke the setup command:
    mqsi_setupdatabase db2 <database_install_directory>

    where <database_install_directory> is the directory in which DB2 is (or will be) installed (for example, /usr/lpp/db2_07_01).

  2. Logon as root.
  3. Create a database instance. Use the commands shown here for guidance for the different platforms.
    1. On AIX:
      /usr/lpp/db2_07_01/instance/db2icrt -u <fence userID> <username>
    2. Start of changeOn Linux, Solaris, or HP-UX: End of change
      /opt/IBM/db2/V7.1/instance/db2icrt -u <fence userID> <username>

    The <username> that you specify on this command determines the nominated owner of the database instance. You are recommended to log on as this user whenever you perform any actions against the database instance (for example, creating or modifying a database). The command examples that are used in this help assume that you are logged on as <username>, and use the tilde (~) character to indicate this in the DB2 commands issued.

    If you are not logged on as the user that owns the database instance, you must modify the commands shown to specify explicit ownership by specifying the owner user ID <username> following the ~ character wherever it is used in the examples.

    For further explanation of database ownership, refer to the DB2 library, accessible on the Web.

  4. Logon as <username>
  5. Create a database (in this example called WBRKBKDB) using the following commands (on some platforms, an explicit path name is required).
    Note: You must insert a space between the starting period and the tilde character in the first command shown here:
    . ~/sqllib/db2profile
    db2start
    db2 create database WBRKBKDB
    db2 connect to WBRKBKDB
    db2 bind ~/sqllib/bnd/@db2cli.lst grant public CLIPKG 5
  6. You must increase the database heap size to ensure it is sufficient for the broker. This task is described in Customizing DB2 databases.

When you issue the command that creates the broker, tables are created within the database to hold the information required.

If you are creating a DB2 database for your broker, and you deploy message flows that use aggregation, you are recommended to apply row-level locking to the aggregate table in the database. See Using aggregation with a DB2 database.

Related tasks
Configuring component databases
Connecting to the databases
Customizing DB2 databases
Authorizing access to the databases

Related reference
Supported databases