简体   繁体   English

通过查询检查SQL服务器中的数据库和表是否启用了CDC

[英]Check if CDC is enabled on database and table in SQL Server by query

How check if CDC is enabled on specific database and table in SQL Server by running a SQL query?如何通过运行 SQL 查询来检查 SQL 服务器中的特定数据库和表是否启用了 CDC?

From the documentation sys.sp_cdc_enable_db (Transact-SQL) in the Remarks section:备注部分的文档sys.sp_cdc_enable_db (Transact-SQL)

sys.sp_cdc_enable_db creates the change data capture objects that have database wide scope, including meta data tables and DDL triggers. sys.sp_cdc_enable_db 创建具有数据库范围 scope 的变更数据捕获对象,包括元数据表和 DDL 触发器。 It also creates the cdc schema and cdc database user and sets the is_cdc_enabled column for the database entry in the sys.databases catalog view to 1.它还创建 cdc 模式和 cdc 数据库用户,并将sys.databases目录视图中数据库条目的 is_cdc_enabled 列设置为 1。

From the documentation sys.sp_cdc_enable_table (Transact-SQL) , also in the Remarks section:从文档sys.sp_cdc_enable_table (Transact-SQL) ,也在备注部分:

sys.sp_cdc_enable_table also 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.如果源表是数据库中第一个启用变更数据捕获的表并且数据库不存在事务发布,则sys.sp_cdc_enable_table还会为数据库创建捕获和清理作业。 It sets the is_tracked_by_cdc column in the sys.tables catalog view to 1.它将sys.tables目录视图中的is_tracked_by_cdc列设置为 1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM