1. 启用数据库:在当前数据库下执行命令
EXEC sys.sp_cdc_enable_db这个过程会在当前数据库下创建6个系统表
select * from sys.databases where is_cdc_enabled = 1
EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = 't1', @role_name = null;注:为第一个表启用CDC后,SQLServer生成两个Agent作业
4. 查看表是否启用了CDC
select name, is_tracked_by_cdc from sys.tables where object_id = OBJECT_ID('dbo.t1')
5. 禁用表("dbo.t1")
EXEC sys.sp_cdc_disable_table @source_schema = 'dbo', @source_name = 't1', @capture_instance = 'all';
EXEC sys.sp_cdc_disable_db;
参考: <<SQL Server 2008 宝典>>