gpt4 book ai didi

sql - 在表级别启用 CDC 时出错

转载 作者:行者123 更新时间:2023-12-03 03:46:50 25 4
gpt4 key购买 nike

我正在 SQL Server 2012 企业版 (11.0.2100.60) 上启用更改数据捕获 (CDC)

。我可以使用以下 SQL 在数据库级别启用它,但无法在表级别启用。

Use DatabaseName
GO

Exec sys.sp_cdc_enable_db
GO

EXEC sys.sp_cdc_enable_table @source_schema = N'dbo'
,@source_name = N'TableName'
, @role_name = NULL
GO

出现错误,例如,

'msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal, Line 623

Could not update the metadata that indicates table [dbo].[TableName] 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 DatabaseName 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.'

有人能帮我摆脱这个困境吗?

提前致谢..!!

最佳答案

我最近也遇到了同样的问题。

我认为,计算机的名称很可能已更改。如果这是真的,请继续阅读...

名称更改计算机会被 SQL 自动识别。但是,系统元数据必须手动更新。(来源:http://msdn.microsoft.com/en-us/library/ms143799.aspx)

SQL语句

sp_dropserver old_name\instancename;
GO
sp_addserver new_name\instancename, local;
GO

示例

sp_dropserver name-PC\SQLEXPRESS;
GO
sp_addserver CLT55\SQLEXPRESS, local;
GO

Reference problem and solution

关于sql - 在表级别启用 CDC 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23969742/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com