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.

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!