Setting the Capture Start Point |
Scroll |
Connect CDC SQData's Change Data Capture was designed to be both robust and forgiving in that it takes a simple and conservative approach when deciding where in the log to start capturing data when first started or upon being restarted following either a scheduled interruption of the capture or an unplanned disruption in a production environment.
The first time the Db2/z Capture agent is started, it uses the "current" Db2 LSN/RBA as starting point by Default. Capture can also be started for the first time at a specific point-in-time by explicitly specifying the start LSN. The current LSN can be determined using the Db2 -DISPLAY LOG command and then selecting a starting LSN based on the Begin Time of a logged transaction. Other transactions that started before that LSN but not already been committed or that are subsequently rolled back are considered in-flight units-of-work and will be ignored along with all other transactions that committed prior to that LSN.
The starting Db2 LSN/RBA is specified in the capture .cab configuration file. The LSN can be set at a global capture agent level; all tables in the configuration file and all Subscribing Engines/Targets or for individual Subscriptions/Targets. An LSN of 0 indicates that capture should start from the current point in the Db2 log. This is used when starting the capture agent for the first time or in a test environment when skipping ahead to the current log point may be desirable. Once the global LSN is established, it would typically never be altered for normal production operation. The capture agent continuously updates the global LSN and the individual Subscription/Target LSNs in the configuration file as changed data is processed. Each time the capture agent starts, data capture is automatically resumed from the last LSN committed by the Subscribing Engines, which guarantees the re-capture of all in-flight transactions.
When adding a new table to an existing configuration file, that table will be captured from the current point in the Db2 log. In a test environment resetting the Global LSN to 0 will start the entire capture from the current point in time.
Example
Set the LSN to 0 (zero means current time) at the capture agent level for all tables with the SQDCONF modify command.
//*----------------------------------------
//*- SET LSN AT GLOBAL LEVEL
//*----------------------------------------
//SETLSN EXEC PGM=SQDCONF
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SQDPARMS DD *
modify /home/sqdata/db2cdc1/DB2CDC1.cab --lsn=0
//*