You can restart data capture where the last data capture
session ended.
Before you begin
The restart position is the sequence number of a CDC record
that was returned in the previous data capture session. You can
use the sequence number of the last CDC record processed in the previous
data capture session. However, to preserve transactional integrity,
you should determine last transaction for which a commit or rollback
operation was not processed and restart capture at the beginning of
that transaction. In this case, the restart position is the lowest
sequence number of the CDC_REC_BEGINTX records for incomplete transactions.
To avoid reprocessing already committed transactions, you should also
determine the largest sequence number of the CDC_REC_COMMTX record
that you have already processed in a previous data capture session.
About this task
To restart data capture:
Procedure
- Determine the restart position.
To preserve
transactional integrity:
- Find all captured transactions that did not return a
CDC_REC_COMMTX or CDC_REC_RBTX record.
- Compare the sequence numbers of the CDC_REC_BEGINTX
records for the incomplete transactions. The lowest sequence number
is the restart position.
- Open a new capture session by running the cdc_opensess() function.
- Run the cdc_startcapture() function
for the table on which you want to restart capturing data.
- Active the session by running the cdc_activatesess() function.
Pass the appropriate sequence number as the position argument.
Data capture restarts for the table at the last transaction
that was processed.
- Discard any transactions whose CDC_REC_COMMTX sequence
number is less than that of the CDC_REC_COMMTX record with the largest
sequence number that you processed in the previous data capture session.