Creating the database in the distributed environment

About this task

To create the database where historical run data is stored, depending on the operating system you use, run the following script:
Windows
dbsetup.bat
UNIX and Linux
dbsetup.sh
In the same directory, the following files are also located:
  • create_database.sql
  • create_tables.sql
  • create_constraints.sql
  • create_indexes.sql
To set up the database, perform the following steps:
  1. Save the script and SQL files locally on your workstation. The DB2® user needs read and write privileges on the directory where you save these files.
  2. Depending on the operating system you are using, do the following:
    Windows
    Open a DB2® command window and access the directory where you saved the files.
    UNIX or Linux
    Log on as DB2® administrator and access the directory where you saved the files.
  3. Before you activate the reporting feature for the first time, run dbsetup as follows:
    dbsetup dbName dbTableSpace dbDataDir port db2Admin db2AdminPwd db2TablePrefix
    where the parameters are positional and indicate the following:
    dbName
    Name of the database to be created.
    dbTableSpace
    Name of the user table space.
    dbDataDir
    Name of the directory where DB2® is to store the data.
    port
    Port number.
    db2Admin
    DB2® administrator user ID.
    db2AdminPwd
    DB2® administrator password.
    db2TablePrefix
    Prefix to be used for the DB2 tables. If you do not specify any value, MDL is used.
    Example:
    dbsetup dbweb tsdbweb twsdbweb_data 50000 db2inst1 mypwd myprefix
  4. The dbsetup command triggers the SQL definitions to create the database, the following DB2® tables, and the constraints, indexes, and views related to those tables:
    DB2TablePrefix.JOS_JOB_STATISTICS
    To store statistics run data.
    DB2TablePrefix.JHR_JOB_HISTORY_RUNS
    To store job run data.
  5. To grant a user access to the reporting tables and views, use the dbgrant script. From a DB2® command prompt, enter the following command:
    dbgrant dbUser dbName db2Admin db2AdminPwd db2TablePrefix
    where the parameters are positional and indicate the following:
    dbUser
    Name of the user to be granted.
    dbName
    Name of the database to be used for the reporting feature.
    db2Admin
    DB2® administrator user ID.
    db2AdminPwd
    DB2® administrator password.
    db2TablePrefix
    Prefix of the DB2 tables. If you do not specify any value, the prefix MDL is used.

    Example:

    dbgrant webuser dbweb goofy goofypwd ABC