CDC 关于Identity columns
Identity columns
https://www.ibm.com/docs/en/idr/11.3.3?topic=luw-creating-database-backup
Last Updated: 2021-03-04
There are a number of issues to consider when replicating the two kinds of DB2® LUW identity columns that the CDC Replication Engine for DB2 for LUW supports: those which are GENERATED ALWAYS and those which are GENERATED BY DEFAULT.
There are two kinds of DB2 LUW identity columns that CDC Replication Engine for DB2 for LUW now supports: those which are GENERATED ALWAYS and those which are GENERATED BY DEFAULT. When replicating these identity columns you should consider the following.
GENERATED ALWAYS identity columns
You can map GENERATED ALWAYS identity columns in source tables to a target column in Management Console.
GENERATED ALWAYS columns in target tables are read-only and cannot be mapped.
GENERATED BY DEFAULT identity columns
CDC Replication handles GENERATED BY DEFAULT identity columns in source tables similarly to columns without the identity property. The value of a source column is retained when mapped to a target identity column. Target identity columns will use the value provided by the database if you set the initial value of the column to Database Default. For more information on how to set the initial value of a target column to Database Default, see your Management Console documentation.
When replicating data to or from tables containing GENERATED BY DEFAULT identity columns, consider the following:
- Any column which has the initial value of the mapping set to Database Default is not applied by CDC Replication. CDC Replication skips the column when applying data and the database provides a value.
- You cannot reference a target identity column that has the initial value set to Database Default in an expression. There is no restriction on the source columns in a similar scenario.
- User exits cannot access the data for any target column that has an initial value set to Database Default in Management Console.
User exits and identity columns
isDataAvailable(int) in the CDC Replication API can be used in a user exit to determine if there is data for a specific column. This method will return false for a target column with an initial value set to Database Default in Management Console. An exception is thrown if you attempt to retrieve the value from a column that is mapped to a target identity column.
浙公网安备 33010602011771号