Azure SQL EXEC sp_cdc_enable_db, ERROR 916 The server principal "dbo." is not able to access the database

Harpal Khanghura 1 Reputation point
2022-07-28T11:14:21.163+00:00

I am new to Azure SQL, moving over after years of working with OnPrem SQL Server. The issue relates to switching on Change Data Capture.
I am using SSMS v18.11.1 logged in with my AD account, also tried with our Azure AD SQL admin account
Connect to the target database and run these commands.
SELECT user_name() -- sanity checked result is rolemember of 'db_owner' role (see error).
SELECT is_cdc_enabled FROM sys.databases WHERE name = '<MyDatabase>' -- returns 0

-- troubles begin
EXEC sys.sp_cdc_enable_db

Msg 22830, Level 16, State 1, Procedure sys.sp_cdc_enable_db_internal, Line 228 [Batch Start Line 0]
Could not update the metadata that indicates database <MyDatabase> is enabled for Change Data Capture. The failure occurred when executing the command 'SetCDCTracked(Value = 1)'. The error returned was 916: 'The server principal "dbo." is not able to access the database "<MyDatabase>" under the current security context.'. Use the action and error to determine the cause of the failure and resubmit the request.

Any help would be greatly appreciated.

Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 34,671 Reputation points MVP Volunteer Moderator
    2022-07-28T12:57:37.033+00:00

    Please try the solution provided on this artcile.

    Hope this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.