Testing Replication

When you finish setting up the replication system, test that replication works as intended.

  1. Connect to the primary IBM DB2 Universal Database instance as a regular user, rather than as the maintenance user. Make sure the regular user also exists in the replicate database.
    1. To connect to the database with CLP, use:
      CONNECT TO dbalias USER db2_user USING db2_user_ps

      where dbalias is the cataloged alias of the primary database, db2_user is the primary database user, and db2_user_ps is the password.

  2. Create a test table in the primary database:
    create table T1( a int, b char(10))
  3. Grant permissions to any new or existing object to be replicated in the primary database:
    grant all on T1 to public
  4. Connect to the replicate IBM DB2 Universal Database instance as a regular user, rather than as the maintenance user.
  5. Create a test table in the replicate database:
    create table T1( a int, b char(10))
  6. Grant permissions to any new or existing object to be replicated in the replicate database, so that the Replication Server maintenance user can update this table:
    grant all on T1 to public
  7. Connect to the Replication Agent and resume replication:
    resume
  8. Mark the table:
    pdb_setreptable T1, mark
  9. After the table is marked and the Replication Agent is in a replicating state, insert test data into the test table and commit it.

    By default, the work performed by the maintenance user of the primary connection is not replicated. The user ID used to insert transactions cannot be the same as the maintenance user defined in the primary connection.

  10. Use your preferred IBM DB2 Universal Database query tool to examine the replicate site for results and compare the contents of your test table from both the primary and replicate sites.