SQL Server – How to Fix Error 8152 When Disabling CDC

change-data-capturesql serversql-server-2016

Trying to disable CDC and getting this error:

Msg 22831, Level 16, State 1, Procedure sp_cdc_disable_db_internal, Line 264
Could not update the metadata that indicates database … is not enabled for Change Data Capture. The failure occurred when executing the command '[sys].[sp_cdc_drop_objects]'. The error returned was 8152: 'String or binary data would be truncated.'. Use the action and error to determine the cause of the failure and resubmit the request.

Best Answer

I got around this by manually dropping the objects the SP was attempting to drop. In the end, the SP ran but required a manual commit afterwards. No more CDC. I was also able to enable CDC successfully.