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.
Prerequisites
Section titled “Prerequisites”1. Archive logging
Section titled “1. Archive logging”Circular logging overwrites log files TwinCommit still needs. Enable archive logging:
db2 update db cfg for PRODDB using LOGARCHMETH1 DISK:/db2/archivedb2 backup db PRODDB to /db2/backup # required after switching from circular logging2. DATA CAPTURE CHANGES
Section titled “2. DATA CAPTURE CHANGES”Every replicated table must log full before and after row images:
ALTER TABLE SALES.ORDERS DATA CAPTURE CHANGES;3. Primary keys
Section titled “3. Primary keys”Every replicated table needs a primary key, which TwinCommit uses for upserts and deletes.
4. Authority
Section titled “4. Authority”The log read API requires DBADM or SYSADM:
GRANT DBADM ON DATABASE TO USER TWINCOMMIT;5. Log retention
Section titled “5. Log retention”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.
Configuration
Section titled “Configuration”source: type: db2 database: PRODDB # alias as cataloged on the TwinCommit host user: ${DB2_USER} # empty = current OS user (local instance) password: ${DB2_PASSWORD}Unsupported objects
Section titled “Unsupported objects”- 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.
Type notes
Section titled “Type notes”- 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.