Back to results for “Architecture”
SQL Server › Change Data Capture (CDC)

How do you disable Change Data Capture on a table or an entire database once it is no longer needed?

Intermediate

Answer

You use the sp_cdc_disable_table stored procedure to remove CDC tracking from a specific table, which also drops its associated change table, and use sp_cdc_disable_db to completely remove CDC support from the entire database once no tables are being tracked anymore.
EXEC sys.sp_cdc_disable_table
  @source_schema = N'dbo',
  @source_name = N'Orders',
  @capture_instance = N'dbo_Orders';
Real-world example A team disables CDC on an old table that is no longer part of their synchronization process, freeing up storage that was being used by its change table and reducing unnecessary overhead on that table's writes.

Common follow-ups: What happens to the historical change data once CDC is disabled?;Do you need to stop any related jobs before disabling CDC?