标签:
昨天实验CDC,在数据库中执行以下语句的时候出错。
EXEC sys.sp_cdc_enable_table @source_schema = N‘stg‘, @source_name = N‘CDCSalesOrderHeader‘, @role_name = N‘cdc_role‘, @supports_net_changes = 1; Msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal, Line 623 Could not update the metadata that indicates table [stg].[CDCSalesOrderHeader] is enabled for Change Data Capture. The failure occurred when executing the command ‘[sys].[sp_cdc_add_job] @job_type = N‘capture‘‘. The error returned was 22836: ‘Could not update the metadata for database TK463DW to indicate that a Change Data Capture job has been added. The failure occurred when executing the command ‘sp_add_jobstep_internal‘. The error returned was 14234: ‘The specified ‘@server‘ is invalid (valid values are returned by sp_helpserver).‘. Use the action and error to determine the cause of the failure and resubmit the request.‘. Use the action and error to determine the cause of the failure and resubmit the request.
一开始看到一个方案,把数据库的owner改为SA。执行以后无效。
EXEC sp_changedbowner ‘sa‘
根据下面错误又查了一下,才发现是因为我改了计算机名字,导致数据库中的实例名不一样。
The error returned was 14234: ‘The specified ‘@server‘ is invalid (valid values are returned by sp_helpserver)
处理步骤:
1.执行sp_helpserver查看当前实例清单
EXEC sp_helpserver
2. 使用sp_addserver 添加实例名
EXEC sp_addserver ‘WIN2K8\SQL2K8‘
sp_addserver 在SQL Server 2012 中已经淘汰,需要改用sp_addlinkedserver
EXEC sp_addlinkedserver ‘WIN2K8\SQL2K8‘,‘SQL Server‘
3. 再次执行CDC代码即可
参考文档
#0164-SQL Server 2012-Discontinued Features-sp_addserver-Remote server registration-Msg: 15663
标签:
原文地址:http://www.cnblogs.com/haseo/p/4261577.html