When trying to activate the Change Data Capture (CDC) feature, and there is already a Transactional Replication solution running in the SQL Server Instance, a conflict is generated.
We tried stopping the Replication publication agent (through the Microsoft SQL Server Management Studio) to configure the CDC. However, the job capture isn't getting created automatically. And, when trying to create it manually, the following message appears:
The capture job cannot be used by Change Data Capture to extract changes from the log when transactional replication is also enabled on the same database. When Change Data Capture and transactional replication are both enabled on a database, use the logreader agent to extract the log changes.
Which corroborates the conflict between these two features.
Thus, if Replication is mandatory and CDC is now trying to be used as well, what alternative could be taken?
There is nothing wrong - both CDC and replication can use that same log reader and so trying to call sp_cdc_add_job
to add the log reader when one already exists will result in that error. Said another way, if you already have replication set up, you can skip the step in the CDC setup process that says to add a log reader (because you already have one).
When you configure both CDC and replication on the same database do one or both not function as intended? That is, if you see changes being captured (CDC) and reflected at subscribers (replication), there's nothing to troubleshoot.