Skip to content

Db2 LUW

TwinCommit captures changes from Db2 for Linux, UNIX and Windows by reading the recovery log through Db2’s native log read API and decoding the row images itself. It does not use SQL Replication, Q Replication, CD tables, triggers or capture agents, and it creates nothing in the source database.

Supported versions: Db2 LUW 11.1, 11.5 and 12.1.

Circular logging overwrites log files TwinCommit still needs. Enable archive logging:

Terminal window
db2 update db cfg for PRODDB using LOGARCHMETH1 DISK:/db2/archive
db2 backup db PRODDB to /db2/backup # required after switching from circular logging

Every replicated table must log full before and after row images:

ALTER TABLE SALES.ORDERS DATA CAPTURE CHANGES;

Every replicated table needs a primary key, which TwinCommit uses for upserts and deletes.

The log read API requires DBADM or SYSADM:

GRANT DBADM ON DATABASE TO USER TWINCOMMIT;

Log files must stay available, active or retrievable from the archive, until TwinCommit has read them.

Run twincommit check to verify all of the above. It prints the fix for anything missing.

source:
type: db2
database: PRODDB # alias as cataloged on the TwinCommit host
user: ${DB2_USER} # empty = current OS user (local instance)
password: ${DB2_PASSWORD}
  • DPF (multi-partition) databases
  • Column-organized (BLU), range-partitioned and MDC tables
  • Columns of type LOB, XML, DECFLOAT or GRAPHIC. List these under exclude_columns; the rest of the table replicates.
  • Character data is expected in code page 1208 (UTF-8).
  • Db2 allows x'00' bytes in character data; PostgreSQL targets do not accept them.
  • TIMESTAMP(12) is rounded to the target’s maximum precision.

See the full data type mapping.