How to add CDC/Audit (Event Streaming) replication on the table which is already a part of the replication
Problem Description
The Change Data Capture(CDC)/Audit function will be renamed to Event Streaming in 2.9.02
| Source server | Target server |
Hostname | dbvlin216 | dbvlin217 |
OS type | Linux | Linux |
Database SID | SRCDB | TGTDB |
Replicated table | SCOTT.ZD9304 | SCOTT.ZD9304 |
You have a running replication on some list of tables
dbvrep> list prepare
List of prepared schemas:
none
List of prepared tables:
DBVREPX4.DBRSCOMMON_HEARTBEAT -> DBVREPX4 (schema rename)
DBVREPX4.DBRSOBJ$ -> DBVREPX4 (schema rename)
DBVREPX4.DBRSUSER$ -> DBVREPX4 (schema rename)
SCOTT.ZD9304 (DDL)
dbvrep> list progress
Progress of replication X4: total/this execution
--------------------------------------------------------------------------------------------------------------------------------------------
SCOTT.ZD9304: 100% Mine:1/1 Unrecov:0/0 Applied:1/1 Conflicts:0/0 Last:31/05/2016 21:31:57/OK
--------------------------------------------------------------------------------------------------------------------------------------------
1 table listed.
Steps Performed
Backup you current configuration
dbvrep> show SCRIPT
*.SETUP_SCRIPT_PATH =
APPLY.SETUP_SCRIPT_PATH = /home/oracle/X4
MINE.SETUP_SCRIPT_PATH = /home/oracle/X4
On source
oracle@dbvlin216[/home/oracle]: tar -czf X4.tar.gz ./X4
On target
Add tns alias to tnsnames.ora on both source & target
Shutdown MINE & APPLY
Re-run setup wizard in dbvrep console, accept current settings and add 3rd database configured in tnsnames.ora
Now add 2nd replication pair
Leave the list of replicated tables empty for 2nd replication pair.
Reuse MINE and configure APPLY1
Confirm and let setup wizard generate files.
Do not run *-all.sh and exit from dbvrep console
Edit *-all.sh and delete/comment lines affecting SRCDB and TGTDB.
From this
To this
Edit config/*-setup.dbvrep script and delete lines working with MINE-APPLY pair (keep MINE-APPLY1 only)
It will look like
Now execute *-all.sh
Connect to target database and grant necessary grant to create triggers
Connect as repository owner
CDC* columns are used by CDC/Audit (Event Streaming) replication
Now you create trigger modifying columns you want to collect by CDC/Audit (Event Streaming) replication
Get MINE_UNIQUE_ID
Generate cdc.dbvrep script file which will prepare CDC/Audit (Event Streaming) on your tables
Run created cdc.dbvrep script
Review APPLY1.sql and execute it against target database
Copy configuration files across your environment and start replication
On target
On source
Now it is done