大网数据广告活动
数据库与应用安全

Can't attach CDC-enabled database

· 52CE 我爱测

This article provides resolutions for the problem where you can't attach a database with Change Data Capture enabled to a SQL Server 2016 or a later version on Windows instance after you detach it on SQL Server 2014 or an earlier version.

This article helps you resolve the problem where you can't attach a CDC-enabled database to an instance of SQL Server 2016 or a later version on Windows.

Original product version:   SQL Server
Original KB number:   3200464

Symptoms

You detach a database with Change Data Capture enabled on SQL Server 2014 or an earlier version, and you attach it to a SQL Server 2016 or a later version on Windows instance. In this situation, you encounter the following error when you run the sp_cdc_enable_table system procedure:

Command

EXEC sys.sp_cdc_enable_table @source_schema='<schema name>',
@source_name='<source name>', @role_name='<role name>',  
@supports_net_changes=1, @allow_partition_switch=0;

Error message

Msg 22832, Level 16, State 1, Procedure
sp_cdc_enable_table_internal, Line 639 [Batch Start Line 0]
Could not update the metadata that indicates table [<schema name>]. [<object name>] is enabled for Change Data Capture. The failure occurred when executing the command 'insert into [cdc].[captured_columns]'. The error returned was 213: 'Column name or number of supplied values does not match table definition.'. Use the action and error to determine the cause of the failure and resubmit the request.

Resolution

To resolve this issue, run sp_cdc_vupgrade after you attach a database on an instance of SQL Server 2016 or a later version on Windows that has Change Data Capture enabled.

For more information, see Attach a database.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 06/12/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。