Skip to content

Manage incremental groups

How an incremental group applies changes, and what you do with one once it exists: run, pause, replay, reset or delete it. To create one, see Incremental groups.

How it works

  1. Baseline. A new member first needs a baseline: a full copy of the source table to the destination. Running the group baselines every member that needs one; with Automatic Snapshot on, the group does it itself. After a short synchronization period, the member receives change data.
  2. Polling. Every Poll Interval, the Replicator Service asks the Capture Agent for the changes staged since the last poll, applies them with the group's DML Replication method, commits, and confirms the position to the Capture Agent, so that it can prune the staged data it no longer needs.
  3. Change data notifications. If the source sends change data notifications, the Capture Agent tells the Replicator Service when changes are committed, and the group polls right away. Notifications are configured on the source, not the group; see Source properties: change data notifications.
  4. Errors. A failed poll is retried (every 60 seconds by default). With an Error Retry Limit, the group pauses itself after that many consecutive failures. With Merge, a table that fails to merge is retried at the next poll instead (see Choosing the apply method).
  5. Apply method. How changes are written depends on DML Replication: see Choosing the apply method: Batch, Merge or Sequence.

Run, pause and other group actions

Button What it does
Run Baselines the members that need it, and applies pending ALTER changes when DDL Replication allows it. It also applies the column changes saved with Alter Destination on Next Run (see Saving an incremental subscription); so does the group's scheduled or automatic run.
Stop Stops a running baseline.
Pause / Resume Stops or restarts applying changes. While paused, the Capture Agent keeps capturing and staging changes; they're applied after you resume.
Replay Applies changes again from an earlier point: a timestamp, a transaction identifier, or the earliest available position.
Reset Removes the group from the Capture Agent and registers it again: every member then needs a new baseline, and the group's statistics are deleted. Pause the group first.
Start Tracing / Stop Tracing Records each run for diagnosis; a failed run keeps its recording in the run history.
Duplicate Creates a new group with the same settings and no members.
Delete Deletes the group and all its members. Pause the group first.
Rename Renames the group; the Capture Agent is updated too.
Export Saves the group's subscriptions to a JSON file, which you can import into another group with Import Subscriptions.

To change the group's settings, open its Properties tab (see Group properties); saving pauses the group, so click Resume afterwards. For the actions on members, see Manage subscriptions.

Status

What each group status means, and what to do: see Group status.

Two-way replication

Two-way replication keeps two databases of the same type (Db2 for i, Db2 for LUW or Oracle) in step in both directions. Use it for a hot standby: if the primary fails, production moves to the secondary, and once the primary is back, the changes made on the secondary flow back to it. It can also share load between two systems, but SQDR doesn't detect or resolve conflicts: if the same row changes on both systems at the same time, the results are unpredictable.

How it works. Two incremental groups replicate in opposite directions: one from the primary (P) to the secondary (Q), one from Q to P. Each Capture Agent ignores the changes made by the user the Replicator Service applies changes with on its database (the agent property filterUserId), so that a change applied by SQDR isn't captured again and sent back.

Before you start

  • Both databases run the same database system. A Capture Agent is set up for each.
  • Every replicated table has a primary key or a unique index, and no table has foreign key constraints.
  • To make the first copy with a backup and restore, both systems have a similar processor architecture and operating system, and the target is at the same database version or later.

Steps

  1. On each database, create the user SQDR reads and writes it with, for example SQDRP on P and SQDRQ on Q. SQDR uses it both for the database's source and for its destination.
  2. On the Configuration tab of P's agent, add filterUserId with the value SQDRP; on Q's agent, filterUserId = SQDRQ. Saving restarts each agent.
  3. Make Q an identical copy of P: with a backup and restore (fast for large databases, and keeps the table privileges), or with a snapshot group from P to Q with Replicate indexes on. Grant the privileges on the copied tables if needed.
  4. In the Data Replicator Manager, create a source and a destination for each database, with the users from step 1.
  5. Create two incremental groups: PtoQ (source P, destination Q) and QtoP (source Q, destination P). In each group's Subscription Wizard Defaults, set Apply Algorithm to Allow UPSERT.
  6. Add the tables to PtoQ. On each member's Destination tab, choose Use existing table for baseline, Append replicated rows to existing data and Manual synchronization, so that the baseline copies no data and keeps the rows already there.
  7. Pause both groups, and copy the members of PtoQ to QtoP with Copy Subscription (see Copy or convert).
  8. Resume both groups and Run each one. With Manual synchronization, the first run stops the members as Suspended; run each group again to complete it.
  9. Test: change rows on P and on Q, and watch the changes reach the other side. Compare the two with TargetChecker.