Assume that you attach a database that's enabled for change data capture in Microsoft SQL Server 2014, 2016, or 2017. If there are transactions to be redone during the startup of the database, change data capture may run into an inconsistent state, that is, change data capture is in disabled state, but the change data capture objects still exist. Additionally, you may encounter the following situations:
When you try to disable the change data capture for this database by using the sp_cdc_disable_db stored procedure, you receive the following error message:The database DatabaseName 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.
When you try to enable the change data capture for this database by using the sp_cdc_enable_db stored procedure, you receive the following error message:Msg 22906, Level 16, State 1, Procedure sp_cdc_enable_db_internal, Line LineNumber
The database DatabaseName cannot be enabled for Change Data Capture because a database user named UserName or a schema named SchemaName 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.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.