DB2 DataPropagator consists of three main components: administration interfaces, change-capture mechanisms, and the Apply program.
This section describes the control tables that manage replication requests, the logical servers that contain the replication components, as well as the main components (administration interfaces, change-capture mechanisms, and the Apply program) and how they communicate with each other.
The replication components use control tables to communicate with each other and to manage replication requests (such as defining and managing replication sources and targets, capturing changes, replicating changes, and tracking how many changes are replicated and how many remain to be done).
The change-capture mechanisms use the following control tables: register table, unit-of-work table, pruning control table, prune lock table, critical section table, warm start table, tuning parameters table, and change data tables.
The Apply program uses the following control tables: Apply trail table, critical section table, pruning control table, prune lock table, register table, subscription set table, subscription statements table, subscription events table, subscription-targets-member table, subscription columns table, unit-of-work table, and change data tables.
All the replication components reside on a logical server. In this book, logical servers refer to databases, not to servers in the client/server sense. For the OS/390 operating system, logical servers are equivalent to subsystems or data-sharing groups (that is, the domain of a single database catalog). There are three types of logical servers:
The Apply program can reside on any of the logical servers in the network. It uses distributed DB2 technology to connect to the control, source, and target servers.
Each Apply program is associated with one control server, which you specify when you start the Apply program. Multiple Apply programs can share a control server.
The control server can be located at the source server, the target server, or any database server that the Apply program can connect to. For better performance, the control server should be located at the server where the Apply program runs because the Apply program frequently reads the control tables at the control server. However, if the source server is in a secure environment, locating the control server at the source server can improve security and let you manage and monitor subscriptions centrally.
You use the administration interfaces to create control tables, which store your replication criteria. There are two user interfaces available: DB2 Control Center and DataJoiner Replication Administration (DJRA).
The DB2 Control Center is a database administration tool that you can use to administer the replication of data between DB2 servers. It automates many initialization functions, such as creating target tables and control tables when you specify target information.
You can use the Control Center to perform the following administration tasks for replication:
The DataJoiner Replication Administration (DJRA) tool is a database administration tool that you can use to perform various replication administration tasks. You can use this tool for DB2-to-DB2 replication; however, you must use it if your replication environment includes non-IBM databases.
You can use DJRA to perform the following administration tasks:
The DB2 data replication solution offers these mechanisms for capturing data:
The following sections describe the Capture program and triggers. For more information about how changes are replicated in Microsoft Access and Microsoft Jet databases, see Mobile replication using DB2 DataPropagator for Microsoft Jet.
When the source is a DB2 table, the Capture program is used to capture changes that are made to the source. The Capture program uses the database log 4 to capture changes made to the source database and enqueues them temporarily.
The Capture program runs at the source server. Typically it runs continuously, but you can stop it while running utilities or modifying replication sources.
Tasks that you can perform with the Capture program include:
See Operations for instructions about performing these tasks.
When the source table is in a non-IBM database (other than Microsoft Access and Microsoft Jet), Capture triggers are used to capture committed changes made to the source. Capture triggers are fired when a particular database event (UPDATE, INSERT, DELETE) occurs.
DJRA automatically creates the Capture triggers. These triggers capture the changes made to defined replication source tables and store them temporarily in tables.
The Apply program reads data directly from source tables or views to initially populate the target table. If you want changes captured, the Apply program reads the changed data that was previously captured and stored temporarily in staging tables, and applies the changes to target tables.
The Apply program generally runs at the target server, but it can run at any server in your network that can connect to the source, control, and target servers. Several Apply program instances can run on the same or different servers. Each Apply program can run using the same authorization, different authorization, or as part of a group of Apply programs where each Apply program in the group runs using the same authorization (user ID).
Tasks that you can perform with the Apply program include:
See Administration for instructions about performing these tasks.
The replication components are independent of each other, so they rely on information that is stored in control tables to communicate with each other. The Capture and Apply programs update control tables to indicate the progress of replication and to coordinate the processing of changes.
The replication components communicate differently depending on whether the source server is a DB2 server or a non-IBM server. For replication between DB2 servers, the Capture program captures changes that are made to data in replication source tables by reading the server log or journal. Then the Capture program places the changes into change data (CD) tables. For non-IBM sources, Capture triggers capture changes and store them in consistent-change-data (CCD) tables.
Each time that the Apply program copies data to the target database, the contents of the target database reflect the changes that were made to the source database. The Apply program works by applying updates accumulated since the Apply program last ran. The Apply program keeps track of the latest update that it makes to each target.
The Capture program uses some of the control tables to indicate what changes have been made to the source database, and the Apply program uses these control tables to detect what needs to be copied to the target database.
Important: The Capture program will not capture any information until the Apply program signals it to do so, and the Apply program will not signal the Capture program to start capturing changes until you define a replication source and associated subscription sets. See Performing the initial replication for more information about the steps you must perform so that the components communicate with each other and replicate changes.
The following steps describe how the Apply and Capture programs communicate in a typical replication scenario to ensure data integrity:
Capturing data from a source database
Applying data to a target database
Pruning the control tables
DJRA, working through DB2 DataJoiner, creates Capture triggers at the non-IBM source table when you define the table as a replication source. Three types of triggers are created on the source table: DELETE, UPDATE, and INSERT. Also, UPDATE triggers are created on the pruning control table and the register synchronization table. The Apply program uses these control tables to detect what needs to be copied to the target database.
The following steps describe how the Capture triggers and the Apply program communicate in a typical replication scenario to ensure data integrity:
Capturing data from a source
Applying data to a target
Pruning the control tables