Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

The database cannot be enabled for Change Data Capture because a database user named 'cdc' or a schema named 'cdc' already exists

$
0
0

Hello,

I am doing refresh activity from PROD to no-prod. The non-prod database has cdc tables. I disabled cdc using sp_cdc_disable_db in non-prod.

Took a copy of the mdf and ndf from prod and and brought the non-prod DB online. 

Issue:

Now the mdf files taken from prod has cdc objects and i could verify cdc tables in sys.tables ( is_tracked_by_cdc=1).

When i try to enable cdc in non-prod DB with sp_cdc_enable_db, i am getting below error

The database cannot be enabled for Change Data Capture because a database user named 'cdc' or a schema named 'cdc' already exists in the current database. These objects are required exclusively by Change Data Capture. Drop or rename the user or schema and retry the operation.

When i try to disable cdc for individual table, i am getting below error

The database is not enabled for Change Data Capture. Ensure that the correct database context is set and retry the operation. To report on the databases enabled for Change Data Capture, query the is_cdc_enabled column in the sys.databases catalog view.

And because of all the above issues when i try to reinitialize subscription, i am getting below error

Cannot truncate table because it is either published or is CDC enabled

What is the workaround now, should i drop all cdc related objects from the non-prod DB and try to enable CDC?

If so, what is the best practice in removing cdc objects . Waiting for you suggestions.

Thanks



Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>