无法更新指示为变更数据捕获启用数据库X的元数据.返回的错误是15517

Ard*_*oli 13 sql sql-server change-data-capture sql-server-2008

我用SQL Server 2008AdventureWorkDB.

我希望Change Data Capture在我的数据库中启用.

我执行这个命令:

USE [AdventureWorksDB];
GO
EXEC sys.sp_cdc_enable_db ;
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

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. 
Run Code Online (Sandbox Code Playgroud)

我怎么解决它?

Ard*_*oli 28

谷歌搜索后

我用这个命令修复它:

EXEC sp_changedbowner 'sa'
Run Code Online (Sandbox Code Playgroud)

我必须将DataBase所有者添加到我的数据库.