Appendix A: Replication Artifacts for Transactional CDC Strategy at the Replicate Database

When the transaction change data capture (CDC) strategy is deployed, a CDC table is created for each table being replicated at the primary database. A transaction log table is also created to record information about all the database transactions that have been replicated. The Replication Agent for SAP HANA populates the CDC tables with the changed data from the primary as well as transaction header information.

Each CDC table has the columns of the primary table from which it is replicated plus four additional columns of auditing information.

Change Data Capture Table
Column Datatype Description
HRAX_TRANS_NUMBER BIGINT

The sequence number for the transaction.

HRAX_TRANS_TIME TIMESTAMP

The time of the transaction.

HRAX_TRANS_TYPE VARCHAR(6)

The operation type.

Valid values are: INSERT | BEFORE | AFTER | DELETE

Note: BEFORE and AFTER show column values before and after an update operation.
HRAX_TRANSACTION_ID VARCHAR(26)

The transaction identifier.

{USER COLUMN…} Same as primary

All columns in the primary table are included in the CDC table.

The transaction log table records all the replicated transactions that are executed at the primary database and the operations that have occurred in those transactions.
Transaction Log Table
Column Datatype Description
HRAX_SEQ_NUMBER BIGINT

The sequence number for the transaction.

HRAX_TRANS_TIME TIMESTAMP

The time of the transaction.

HRAX_TRANS_TYPE VARCHAR(6)

The operation type.

Valid values are: INSERT | BEFORE | AFTER | DELETE.

HRAX_TRANSACTION_ID VARCHAR(26) The transaction identifier.
HRAX_TABLE_NAME VARCHAR(255) The name of the modified table.
These queries return all operations in the CDC_CUSTOMER table ordered by transaction sequence number:
select *
from TGT.CDC_CUSTOMER
where HRAX_TRANS_NUMBER > 3 
order by HRAX_TRANS_NUMBER;
and
select CUST.HRAX_TRANS_NUMBER
,CUST.HRAX_TRANS_TIME
,CUST.HRAX_TRANSACTION_ID
,CUST.HRAX_TRANS_TYPE
,CUST.c_w_id
,CUST.c_d_id
from TGT.CDC_CUSTOMER AS CUST, TGT.CDC_TRANSACTION_LOG AS TXNLOG
where (CUST.HRAX_TRANS_NUMBER = TXNLOG.HRAX_SEQ_NUMBER)
and (TXNLOG.HRAX_SEQ_NUMBER > 3 )
ORDER BY CUST.HRAX_TRANS_NUMBER;
This query returns a list of all the tables that have received operations from a certain time:
select CUST.HRAX_TRANS_NUMBER
,CUST.HRAX_TRANS_TIME
,CUST.HRAX_TRANSACTION_ID
,CUST.HRAX_TRANS_TYPE
,CUST.c_w_id
,CUST.c_d_id
from CESTARGET.CDC_CUSTOMER CUST
where CUST.HRAX_TRANS_TIME > time'2014-02-27 12:00:00'
ORDER BY CUST.HRAX_TRANS_NUMBER;
This query returns a list of all the tables that have received delete operations from a certain time:
select DISTINCT(TXNLOG.HRAX_TABLE_NAME)
from CESTARGET.CDC_TRANSACTION_LOG TXNLOG
where TXNLOG.HRAX_TRANS_TIME > time'2014-02-27 23:54:40'
and TXNLOG.HRAX_TRANS_TYPE = 'DEL'