Opens in a new tab

Rackspace Insights

Introduction to Change Data Capture (CDC)

by Ravi Agarwal

SQL Server Database Administrator, Rackspace Technology

November 30, 2022

Introduction to Change Data Capture (CDC)

What is Change Data Capture (CDC)?

Change data capture (CDC) uses SQL Server agent to capture DML activities like deleting, updating, and inserting on a table. 

These DML activities are captured in a table format in a relational database. In SQL server, CDC works similarly to SQL server transactional replication. It is commonly used for replicating data from databases to a data warehouse by syncing the database change logs rather than fetching data from tables.

If a CDC is enabled for a table, any DML operation on that table is written to a transaction log. These changes are now captured by the CDC capture job from a transaction log file and written to different change data capture tables. Now different CDC functions access these tables to get change data.

To learn more, you can click here

For a customer, CDC failed and gave the following error:


SELECT * FROM cdc.fn_cdc_get_net_changes_dbo_tablename(@from_lsn, @to_lsn, 'all')