Configuring and verifying the primary IBM DB2 Universal Database for replication

Before you install Replication Agent, configure the primary IBM DB2 Universal Database for replication.

StepsTo verify the current archiving setting of the transaction log

Replication Agent requires that the primary IBM DB2 Universal Database transaction logging be archive logging, not circular logging.

  1. Determine the LOGARCHMETH1 setting.

    1. Connect to the database by entering the following command at the CLP prompt:

      CONNECT TO NYudb9 USER db2_user USING db2_user_ps
      

      Here, NYudb9 is the primary database, db2_user is the primary database user, and db2_user_ps is the password.

    2. Issue the following command to determine LOGARCHMETH1 setting:

      GET DB CFG FOR dbalias
      

      Here, dbalias is the cataloged alias of the primary database.

  2. If the results do not show that LOGARCHMETH1 is set to LOGRETAIN or to the path name of the directory to which logs are archived, set it:

    • To use the default archive location, issue this command

      UPDATE DATABASE CONFIGURATION USING logarchmeth1 LOGRETAIN
      
    • To use a specific archive location, issue this command:

      UPDATE DATABASE CONFIGURATION USING logarchmeth1 DISK:path
      

      Here, path is the full path name of the directory where the archive logs are to be stored.

StepsTo set the IBM DB2 Universal Database connectivity autocommit parameter

Replication Agent requires that the IBM DB2 Universal Database connectivity autocommit parameter be turned on (autocommit=1). The autocommit parameter is specified in the DB2 call-level interface (CLI) configuration file for the primary database. If the autocommit parameter is not turned on, a deadlock problem can occur.

  1. To set the autocommit parameter, edit the db2cli.ini file.

    It is located either in $DB2DIR/cfg (where $DB2DIR is the path to the IBM DB2 Universal Database client installation) or in $HOME/sqllib (where $HOME is the home directory of the IBM DB2 Universal Database instance owner of a IBM DB2 Universal Database server installation).

StepsTo create an IBM DB2 Universal Database user and grant permissions

To connect to the primary IBM DB2 Universal Database and to read the IBM DB2 Universal Database transaction log, Replication Agent requires an IBM DB2 Universal Database user ID, and that user must have SYSADM or DBADM authority.

  1. Create a new operating system user named ra_user using commands appropriate for your operating system.

    For example, the following command can be used to create a user named ra_user on the UNIX and Linux operating systems:

    useradd -gusers -Gmgmt -s/bin/shell -ppassword 
    -d/home/ra_user -m ra_user
    

    Here, password is the password corresponding to the ra_user user name.

  2. Start the Control Center administration tool by choosing Start | Programs | IBM DB2 | Control Center.

  3. Configure the Control Center administration tool to connect to the primary IBM DB2 Universal Database according to the IBM documentation. Once the Control Center administration tool has been configured, the primary database displays in the All Databases view.

  4. In the Control Center administration tool display window, right-click on the primary database name, and select Authorities from the context menu.

  5. In the Database Authorities window, click Add User.

  6. In the Add User window, select ra_user from the list of displayed operating system users, and click OK.

  7. Click Grant All to add necessary authorities to ra_user.

  8. Add a user temporary system-managed table space with a page size of at least 8KB.

    1. In the Control Center All Databases view, right-click the Table Spaces folder under your primary database, and select Create from the context menu.

    2. In the Name window, specify a name for the new table space, and select the Let DB2 Manage My Storage radio button. Click Next.

    3. In the Type window, select User Temporary, and click Next.

    4. In the Buffer Pool window, click Create.

    5. In the Create Buffer Pool window, specify a name for the buffer pool, specify 8KB as the page size in the drop-down menu, select Create Bufferpool Immediately, and click OK.

    6. Click Finish to create the table space. The new table space displays in the Table Spaces folder.

NoteIn a POC environment, the user is created by an IBM DB2 Universal Database system administrator.