Wednesday, November 13, 2013

Enabling Change Data Capture - SQL Server

Before a capture instance can be created for individual tables, a member of the sysadmin fixed server role must first enable the database for change data capture. This is done by running the stored procedure sys.sp_cdc_enable_db (Transact-SQL) in the context of the correct database.

To determine if a database already has CDC enabled,

SELECT name, CASE WHEN is_cdc_enabled = 0 THEN 'Off' ELSE 'CDC On' END, compatibility_level FROM sys.databases

WHERE name like '%%'