Altering a table to capture changed data
You can use the ALTER TABLE statement to write data changes for that table to a log in an expanded format for use in data replication processing.
About this task
The DATA CAPTURE attribute of a table specifies whether a full or partial before image is written out to the log for updates to table rows. Tables are created with the DATA CAPTURE NONE attribute by default. This attribute means that Db2 writes out only partial before images in log records for updates to the table rows. To enable data replication, a table must be defined with the DATA CAPTURE CHANGES attribute, so that Db2 writes out full before images in log records instead of partial before images.
When a table is defined with the DATA CAPTURE CHANGES attribute, the full before images in the log records include the following information not included in the partial images:
- SQL data change operations
- Adding columns (using the ADD COLUMN clause)
- Changing columns (using the ALTER COLUMN clause)
Data replication tools such as the following products use the expanded log records for replication processing:
The expanded format log records are not available for LOB and XML data.
Procedure
Results
- Quiesce static packages that depend on the altered table
- Quiesce and invalidate cached and stabilized dynamic statements that depend on the altered table
Because the DATA CAPTURE alteration waits for applications that depend on the altered table to commit, continuous concurrent activity on the table might cause the ALTER TABLE statement to fail.