Preparing the Db2 databases

Create your Db2® database for your production environment.

Before you begin

The steps for preparing the Document Processing engine databases require scripts and additional files that are provided in GitHub repositories.

When you prepared your cluster for deployment, you created a copy of the Git repository that contains supporting configuration files and scripts for the Cloud Pak for Business Automation deployment.

  1. Locate the cert-kubernetes repository that you extracted from the https://github.com/icp4a/cert-kubernetes/tree/24.0.0 URL in Preparing a client to connect to the cluster. This repository contains the scripts that you need to prepare and initialize your Db2 databases.
  2. Change the directory to cert-kubernetes. Then, copy the ACA/configuration-ha/DB2 folder to your IBM Db2 server.
Tip: If you need to know which database versions are supported for your installation, use this IBM Support page to generate a software compatibility report.

About this task

The provided scripts can be used to both create and initialize the databases for Document Processing engine. If you prefer to create your own databases and use the scripts only to initialize the databases, then the databases that you create must meet these minimum requirements:
Minimum requirements for the Base database
  • For performance reasons, create table spaces by using automatic storage rather than database-managed or system-managed table spaces.
  • Set the Db2 code set to UTF-8 encoding.
  • Set the page size to 32 KB.
  • Grant CONNECT,DATAACCESS,CREATETAB privileges to that database user that will access the database.
Minimum requirements for the Project database
  • For performance reasons, create table spaces by using automatic storage rather than database-managed or system-managed table spaces.
  • Set the Db2 code set to UTF-8 encoding.
  • Set the page size to 32 KB.
  • Grant CONNECT,DATAACCESS,CREATETAB privileges to that database user that will access the database.
  • Increase the transaction log size (LOGFILSIZ) and number of primary log files (LOGPRIMARY). Recommended minimum values for high volume environment: LOGFILSIZ = 7500 and LOGPRIMARY = 13
  • Drop the default user table space.
  • Create a buffer pool of pagesize 32K and a large user table space using that buffer pool.
  • Create a buffer pool of pagesize 32K and a user temporary table space using that buffer pool.
  • Create a buffer pool of pagesize 32K and a system temporary table space using that buffer pool.
  • Grant use of the table spaces to whichever database user will be used for accessing the project database.

Procedure

To create and initialize the Base database by using the provided scripts:

  1. From the DB2 folder, run the script CreateBaseDB.sh on the DB2® server. The user who runs the script must have privileges to run the Db2 command line and admin privileges on Db2.
    You can skip step 2.

If you created your own Base database instead of running CreateBaseDB.sh, manually initialize the Base database:

  1. From the Db2 folder, run the script InitBaseDB.sh on the Db2 server. The user who runs the script must have privileges to run the Db2 command line and admin privileges on Db2.
    When prompted, enter the following information:
    • Enter the name of the Base database that you created.
    • Enter the name of an existing database user with read and write privileges for the Base database.
    Note: When you specify the parameter values in the CR YAML, you use values for this database in the following parameters:
    datasource_configuration
         dc_ca_datasource
             database_servername: YOUR_DATABASE_SERVER 
             database_name: YOUR_DATABASE_NAME         
             database_port: YOUR_DATABASE_PORT

To create and initialize the Project database by using the provided scripts:

  1. From the DB2 folder, run the script AddTenant.sh as a user with privileges to run the Db2 command line and admin privileges on Db2.
    When prompted by the script for a project ID, provide a unique value that is not being used by an existing project.
  2. Repeat the previous step for each Project database that you need to create.
    You can skip steps 5 and 6.

If you created your own Project database instead of running AddTenant.sh, manually initialize the Project database:

  1. From the Db2 folder, run the script InitTenantDB.sh as a user with privileges to run the Db2 command line and admin privileges for the Base database.
    When prompted by the script for a project ID, provide a unique value that is not being used by an existing project.
  2. Repeat the previous step for each Project database that you need to create.
    Note: When you specify the parameter values in the CR YAML, you use values for this database in the following parameters, for example if your project databases are named proj01db and proj02db:
    dc_ca_datasource:
      tenant_databases:
      - proj01db 
      - proj02db

    This is the same location where you specify additional databases if you need to create more for additional projects.

  3. (HADR only) If you are using Db2 databases that are HADR enabled, complete the HADR configuration:
    1. Configure Automatic Client Reroute. For more information, see Configuring automatic client reroute and HADR.
    2. Configure the following CR YAML parameters with the HADR database values:
      datasource_configuration: 
        dc_ca_datasource:
          dc_hadr_standby_servername: YOUR_DATABASE_STANDBY_SERVER
          dc_hadr_standby_port: YOUR_DATABASE_STANDBY_PORT
    3. If you are using Db2 databases for HADR enabled and the hostnames of the Db2 servers cannot be resolved by DNS, also specify the corresponding IP addresses of the primary and standby Db2 servers in the CR YAML parameters:
      datasource_configuration:
        dc_ca_datasource:
          database_ip: YOUR_DATABASE_SERVER_IP_ADDRESS
          dc_hadr_standby_ip: YOUR_DATABASE_STANDBY_IP_ADDRESS

What to do next

If you did not use the cp4a-prerequisites.sh script to generate the YAML template files for the database secrets, go to Creating secrets to protect sensitive Document Processing configuration data.