Create Db2 Region and Cross-Region Databases Using Script Files

Attention: This feature is in Early Adopter Product (EAP) release status. We will continue the development of additional features and provide additional interfaces via patch updates and future releases. Please contact Micro Focus SupportLine if you require further clarification.

For Db2 databases, you can use the conventional method of database creation, using ODBC DSNs, as detailed for the other supported database types; but due to the Db2 architecture, it is preferable to create the databases ahead of time, using an SQL script file.

  1. To create a region database script file, on the command line, enter the following command:
    dbfhadmin -script -type:region -provider:db2 -name:<es-name> -file:<script-name.sql> [-existdb:<db-name>|-db:<db-name>]

    where <es-name> is the name of the intended enterprise server region, which must be 8 characters or less (a Db2 restriction).

    The two mutually exclusive optional parameters that you can specify determine where the database is to be created: if the region database is to be within an existing Db2 database (for example, you may have one database that holds all datastores, region databases, and a cross-region database), use the -existdb option; to create a new Db2 database, use the -db option to specify the name of the database. If you omit both options, a new database with a default name will be created - the default name for a region database is the value given for the -name option.

    Note: If you omit the -file option, the default name is create_region_db2.sql.
  2. To create a cross-region database script file, on the command line, enter the following command:
    dbfhadmin -script -type:crossregion -provider:db2 -file:<script-name.sql> [-existdb:<db-name>|-db:<db-name>]

    The two mutually exclusive optional parameters that you can specify determine where the database is to be created: if the cross-region database is to be within an existing Db2 database that does not already contain a cross-region database, use the -existdb option; to create a new Db2 database, use the -db option to specify the name of the database. If you omit both options, a new database with a default name will be created - the default name for a cross-region database is $XREGN$.

    Note: If you omit the -file option, the default name is create_crossregion_db2.sql.
    Once you have created the script files, use the dbfhadmin utility to run them, and create the required databases.
  3. To create a region database, on the command line, enter the following command:
    dbfhadmin -createdb -file:<script-name.sql> -type:region -provider:db2

    where <script-name.sql> is the name of the script file that was created in an earlier step.

  4. To create a cross-region database, on the command line, enter the following command:
    dbfhadmin -createdb -file:<script-name.sql> -type:crossregion -provider:db2
    Note: If you specify an existing database, it cannot already contain a cross-region database.

Next, you must configure your enterprise server region to use the database(s).