I am trying to enable CDC on Database and then table but some times I receive below error ..Its like once in 10 times
Msg 22830, Level 16, State 1, Procedure sp_cdc_enable_db_internal, Line 193 [Batch Start Line 17]
Could not update the metadata that indicates database XXX is enabled for Change Data Capture. The failure occurred when executing the command 'sp_addrolemember 'db_owner', 'cdc''. The error returned was 1205: 'Transaction (Process ID 62) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.'. Use the action and error to determine the cause of the failure and resubmit the request.
Msg 22901, Level 16, State 1, Procedure sp_cdc_enable_table, Line 39 [Batch Start Line 17]
The database 'XXX' 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.