How to fix CDC activation error in SQL Server

I’m having trouble turning on Change Data Capture in my SQL Server database. When I run EXEC sys.sp_cdc_enable_db, I get this error message:

Error Details:

Could not update the metadata that indicates database Y is enabled for Change Data Capture.
The failure occurred when executing the command 'create user cdc'.
The error returned was 15562: 'The module being executed is not trusted. Either the owner 
of the database of the module needs to be granted authenticate permission, or the module 
needs to be digitally signed.'

I already tried several things like setting sa as the database owner and also attempted to manually create the cdc user account, but none of these solutions worked for me.

Has anyone encountered this issue before? What other troubleshooting steps should I consider to resolve this CDC enablement problem?

check ur database collation settings - I’ve hit this exact error when there’s a mismatch between server and database collation. Also try running the cdc enable command as sysadmin instead of db_owner. sometimes that fixes the authentication issues.

This happens when the database trustworthy property is disabled - CDC can’t create its internal objects without it. Run ALTER DATABASE [YourDatabaseName] SET TRUSTWORTHY ON and you’re good to go. I hit this same issue during a production deployment and that command fixed it instantly. Once trustworthy is enabled, your CDC command should work fine. Just heads up - enabling trustworthy has security implications, so make sure your database owner is someone you trust. Also check that CLR integration is enabled at the server level with sp_configure 'clr enabled', 1 then RECONFIGURE if you need it.

interesting error! is sql server agent running? cdc won’t initialize properly without it. what sql server version r u using? older versions had specific quirks with this error that needed different fixes.