DB2 10.5 for Linux, UNIX, and Windows

Setting up replication for shadow tables with CHCCLP

To set up replication for shadow tables in Linux and UNIX operating systems, use the CHCCLP command-line interface for IBM® InfoSphere® Change Data Capture to create one subscription for all shadow tables in your database and one table mapping for each shadow table.

Before you begin

About this task

Creating a subscription defines a container for the set of table mappings that you must define for each shadow table. Creating a table mapping defines the source table for replicating data to the shadow table.

A subscription provides a single point of control for common replication operations such as mirroring and refreshing. Mirroring is the process that replicates changed data from the source table to the shadow table. Refreshing is the process that synchronizes the shadow table with the current contents of the source table.

Be sure to create only one subscription for all shadow tables in the same database so that there is only one synchronization point for all shadow tables in the database.

Procedure

To set up replication for shadow tables:

  1. Log in to the access-server-host as cdc-user.
  2. Start the CHCCLP command-line interface for InfoSphere CDC by issuing the following command:
    $ /access-server-installation-dir/bin/chcclp 
  3. Connect to the access server by issuing the connect server command as follows:
    connect server hostname access-server-host port access-server-port
            username access-server-user password access-server-user-password;
  4. Connect to the datastore that you configured in Setting up the datastore for shadow tables with commands for IBM InfoSphere CDC Access Server by issuing the connect datastore command as follows:
    connect datastore name access-server-datastore-name;
  5. Create the subscription and set it to the current context by issuing the select subscription command as follows:
    add subscription name subscription-name persistency yes;
    Set the subscription as persistent so that it is automatically restarted after certain errors.
  6. Create a table mapping for each shadow table in the subscription that you created in step 5 by issuing the add table mapping command as follows:
    add table mapping sourceschema source-schema-name
                      sourcetable source-table-name
                      targetschema shadow-table-schema-name
                      targettable shadow-table-name
                      targetIndexMode index
                      targetIndexName shadow-pk-schema-name.shadow-pk-index-name
                      type standard method mirror;
    This command specifies standard as the mapping type, index as the target indexing mode, and the name of the primary key index of the shadow table as the index name. These values are required for table mappings of shadow tables.

What to do next

After you create all table mappings, start your subscription to begin replicating data to the shadow tables. For more information, see Replicating data to shadow tables with CHCCLP.