Hi,
We are working in a environment we replication and CDC are enabled. We accidently dropped CDC metadata elements like tables,view and users. When we try to disable CDC for that particulare database we getting below error, we tried to overcome this error by creating the deleted object manually but still struck with the error. Please guide to over come this error.
EXEC sys.sp_cdc_Disable_db
Msg 3930, Level 16, State 1, Procedure sp_cdc_disable_db_internal, Line 225 The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction. Msg 22831, Level 16, State 1, Procedure sp_cdc_disable_db_internal, Line 231 Could not update the metadata that indicates database Trading is not enabled for Change Data Capture. The failure occurred when executing the command 'create user cdc'. The error returned was 297: 'The user does not have permission to perform this action.'. Use the action and error to determine the cause of the failure and resubmit the request. Msg 266, Level 16, State 2, Procedure sp_cdc_disable_db_internal, Line 0 Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1. Msg 266, Level 16, State 2, Procedure sp_cdc_disable_db, Line 0 Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1. Msg 3998, Level 16, State 1, Line 1 Uncommittable transaction is detected at the end of the batch. The transaction is rolled back.
I create User CDC to get rid of above error then I am getting below error
Msg 3930, Level 16, State 1, Procedure sp_cdc_disable_db_internal, Line 225 The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction. Msg 22831, Level 16, State 1, Procedure sp_cdc_disable_db_internal, Line 231 Could not update the metadata that indicates database Trading is not enabled for Change Data Capture. The failure occurred when executing the command 'DROP user cdc'. The error returned was 297: 'The user does not have permission to perform this action.'. Use the action and error to determine the cause of the failure and resubmit the request. Msg 266, Level 16, State 2, Procedure sp_cdc_disable_db_internal, Line 0 Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1. Msg 266, Level 16, State 2, Procedure sp_cdc_disable_db, Line 0 Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1. Msg 3998, Level 16, State 1, Line 1 Uncommittable transaction is detected at the end of the batch. The transaction is rolled back.
We are not able to fix the above error.
Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.