Setting Change Data Capture (CDC)

Last updated: 2024-09-06 18:12:11

Change data capture (CDC) is used to capture insertions, updates, and deletion applied to SQL Server tables and provide the details of these changes in a convenient relational format.
The change table used for Change Data Capture (CDC) contains the column structures of the source tables tracked by the image, as well as metadata to understand the changes. After enabling CDC for a table, all DML and DDL operations on it will be recorded, helping track changes to the table.
Note:
The console enables the Change Data Capture (CDC) feature only at the database level. To enable table-level CDC, you can execute: EXEC sys.sp_cdc_enable_table.

Enabling/Disabling CDC for one database

1. Log in to the SQL Server console. In the instance list, click the instance ID or Operation column's Manage to enter the instance management page.
2. On the instance management page, select the DMC tab. Locate the row of the target database and click Operation > Others > Enable/Disable CDC.


3. The pop-up window displays the database's name and current CDC status. After enabling or disabling CDC, click OK.


You can view the task progress of enabling or disabling CDC through Running Tasks in the top-right corner of the DMC tab.




Batch enabling/disabling CDC for multiple databases

1. Log in to the SQL Server Console. In the instance list, click the instance ID to enter the instance management page.
2. On the instance management page, select the DMC tab, select the rows of the target databases, and click Batch Management > Batch Enable/Disable CDC.


3. The pop-up window displays the names and current CDC status of the selected databases. After enabling or disabling CDC, click OK.


You can view the task progress of enabling or disabling CDC through Running Tasks in the top-right corner of the DMC tab.

Related APIs

API
Description
The API (ModifyDatabaseCDC) is used to enable or disable Change Data Capture (CDC) for the database.