How check if CDC is enabled on specific database and table in SQL Server by running a SQL query?
From the documentation for sys.sp_cdc_enable_db (Transact-SQL) in the Remarks section:
sys.sp_cdc_enable_dbcreates the change data capture objects that have database wide scope, including meta data tables and DDL triggers. It also creates the cdc schema and cdc database user and sets theis_cdc_enabledcolumn for the database entry in thesys.databasescatalog view to1.
select
name,
is_cdc_enabled
from sys.databases;
From the documentation for sys.sp_cdc_enable_table (Transact-SQL), also in the Remarks section:
sys.sp_cdc_enable_tablealso creates the capture and cleanup jobs for the database if the source table is the first table in the database to be enabled for change data capture and no transactional publications exist for the database. It sets theis_tracked_by_cdccolumn in thesys.tablescatalog view to1.
select
name,
is_tracked_by_cdc
from sys.tables;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With