CDC is enabled, but cdc.dbo_CT table is not

2019-02-18 22:42发布

问题:

I have enabled CDC using the following steps:

exec sys.sp_cdc_enable_db;

exec sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'table_name',
@role_name = N'CDC_Access',
@supports_net_changes = 1;

I can see that a CT table has been created in the System Tables; SQL Server Agent is on, and I can see the cdc.db_name_capture job has been created and is running.

However, even though the table_name table is being populated, I never see anything in the CT table. I have other tables that have CDC enabled for them in the same database which are being updated, and CDC is capturing data for them and storing it in the CT table created for that specific table.

Why would this one table not be capturing data even though other tables are?

I read online that perhaps it has something to do with the transaction log becoming too large, but I still have plenty of drive space left (~2TB free).

What can I do to debug this issue?

Thank you so much, in advance! :)

Edit 1

Here is the output of exec sys.sp_cdc_help_change_data_capture. subscription_events is the table that I am having troubles with.

Edit 2

Here is the output of exec sys.sp_cdc_help_jobs;.

Edit 3

Here is the output of select * from sys.dm_cdc_log_scan_sessions;.

Here is the output of select * from sys.dm_cdc_errors;

Edit 4

Running select serverproperty('productversion') provides the following version number: 11.0.3401.0.

回答1:

Do the following:

  1. Stop the capture job;
  2. Run EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1; EXEC sp_replflush;
  3. Close this query window in which you executed these commands;
  4. Start the capture job;
  5. Check the sys.dm_cdc_errors table for new rows and check if the changes starting to be visible.