Capture data from DB2 sources

After you register your DB2 replication sources and create subscription sets for the source and target, you can start capturing the changes made to your sources. Here you can use a program called the Capture program to do this. The basic operations on Capture are starting, stopping, and querying the Capture programs.

After you start the Capture program and that program receives signals from the Apply program to indicate that the sources and targets are synchronized, the Capture program reads the DB2 log sequentially for changes to the source tables in which you are interested. If it reads a change to one of your source tables, the Capture program adds the change to the corresponding database transaction that it is retaining in memory. Transactions in memory are potentially subsets of the corresponding transactions in the log. They contain only changes to your source tables. The Capture program collects changes in memory until it reads either a ROLLBACK or a COMMIT statement for the transaction in which those changes are made, and it only stores the changes associated with the committed transaction.

For example, if you registered the table catalog as replication sources, SQL replication created a CD table as part of the registration process. After you start the Capture program, you can go through the steps (Figure 5-5) to complete capture progress:

1.xxxx

Capture program receives signals from the Apply program to indicate that the target tables are synchronized with the source tables.

2.xxxx

Application A makes a series of changes to the table catalog.

3.xxxx

The Capture program reads the DB2 logs for changes to those source tables.

4.xxxx

The Capture program collects these changes in memory.

5.xxxx

Application A issues a COMMIT statement.

6.xxxx

When the Capture program reads this statement, it appends a copy of each change to the CD table for the table catalog.

Figure 5-5 Capture data from source table
xxxx