共用方式為


Could not update the metadata that indicates database is enabled for Change Data Capture. The failure occurred when executing the command SetCDCTracked(Value = 1)

This error message comes when you are trying to enable CDC on a SQL Server 2008 database for which the owner is not "sa". The exact error message will be as shown below.

Msg 22830, Level 16, State 1, Procedure sp_cdc_enable_db_internal, Line 186

Could not update the metadata that indicates database [XXXXX] is enabled for Change Data Capture. The failure occurred when executing the command 'SetCDCTracked(Value = 1)'. The error returned was 15404: 'Could not obtain information about Windows NT group/user 'Domain\user', error code 0x5.'. Use the action and error to determine the cause of the failure and resubmit the request.

Msg 266, Level 16, State 2, Procedure sp_cdc_enable_db_internal, Line 0

Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2.

Msg 266, Level 16, State 2, Procedure sp_cdc_enable_db, Line 0

Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2.

The fix for this is to change the databse owner to "sa" by executing the below script.

USE

<Database>

GO

EXEC

sp_changedbowner 'sa'

Read the below KB article for more details.

https://support.microsoft.com/kb/913423

Comments

  • Anonymous
    July 26, 2010
    Thanks a lot for the tip. I was struggling with the issue in weekend on Poc work related to cdc with mirror db, your tip helped me  in-time solve problem and progress further.   Thanks & keep posting good tips... :)

  • Anonymous
    September 21, 2010
    I have a situation where the owner is 'sa' and I still continually get this message.  I have executed the sp_changedbowner 'sa' command, even detached and re-attached the database, and it still occurs.

  • Anonymous
    September 30, 2010
    awesome, thanks

  • Anonymous
    July 20, 2011
    I have changed the DB Owner still getting the same error ....plz help

  • Anonymous
    October 05, 2011
    Thanks a lot.

  • Anonymous
    April 17, 2013
    This helped to me!

  • Anonymous
    July 13, 2014
    I've never posted anything on a discussion before, but you helped me a lot Ramoji. I've been trying to enable CDC on a database for a couple of DAYS now - changing DB permissions, etc... THANK YOU!

  • Anonymous
    December 16, 2014
    Thank you for sharing this.  Really helped!

  • Anonymous
    October 06, 2015
    The comment has been removed