Could not update the metadata that indicates database X is enabled for Change Data Capture. The error returned was 15517

26.3k views Asked by At

I use SQL Server 2008 and AdventureWorkDB.

I want enable Change Data Capture in my database.

I execute this command :

USE [AdventureWorksDB];
GO
EXEC sys.sp_cdc_enable_db ;

But i get this error :

Could not update the metadata that indicates database X is enabled for 
Change Data Capture. 
The failure occurred when executing the command 'SetCDCTracked(Value = 1)'. 
The error returned was 15517: 
    'Cannot execute as the database principal because 
     the principal "dbo" does not exist, 
     this type of principal cannot be impersonated, 
     or you do not have permission.'. 
Use the action and error to determine the cause of the failure and resubmit 
the request. 

How I can fix it ?

2

There are 2 answers

2
Ardalan Shahgholi On BEST ANSWER

After googling

I fix it with this command :

EXEC sp_changedbowner 'sa'

I must add DataBase owner to my database.

0
Zackary Soderquist On

This did not resolve my issue. I checked to make sure the svrname in sysservers was the same as the actual server name and I found a discrepancy. Apparently this was a repurposed server.

To check I used:

SELECT srvname AS OldName FROM master.dbo.sysservers
SELECT SERVERPROPERTY('ServerName') AS NewName

To resolve I used:

sp_dropserver '<oldname>';  
GO  
sp_addserver '<newname>', local;  
GO