1

我在 SQL Server 2005 中设置了事务复制,并且禁用了设置复制时创建的 DDL 触发器。在玩了一会儿(了解会发生什么)之后,事务被破坏了,因为我已经将发布者上的一列更改为VARCHAR订阅INT者上的列。我找到了两个程序,这将有助于跳过这个有问题的交易

EXEC sp_helpsubscriptionerrors
    @publisher='DB1',@publisher_db='repl_test',@publication='repl_test_table',
    @subscriber='DB2',@subscriber_db='repl_test'

这给了我一个结果集,我可以在其中看到错误(转换VARCHAR为失败INT

id time                    [...] error_code error_text                                             xact_seqno
24 2012-02-23 08:33:35.313 [...] 8114       Fehler beim Konvertieren des varchar-Datentyps in int. 0x00139791000CC79C000600000000
24 2012-02-23 08:33:35.310 [...] 8114       Fehler beim Konvertieren des varchar-Datentyps in int. 0x00139791000CC79C000600000000
[...]

我使用xact_seqno来自结果(0x00139791000CC79C000600000000)在下一步执行以下过程

EXEC sp_setsubscriptionxactseqno
    @publisher='DB1',@publisher_db='repl_test',@publication='repl_test_table',
    @xact_seqno=0x00139791000CC79C000600000000

这会说:

错误 20017 - 订阅者上不存在订阅。

嗯?

4

2 回答 2

2

啊,看看内部代码可以看到,sp_setsubscriptionxactseqno这个过程必须订阅数据库中执行(而不是在distribution数据库中,sp_helpsubscriptionerrors必须在哪里执行)......但这在 MSDN 中没有记录。

于 2012-02-23T07:50:52.037 回答
0

对订阅者执行 sp_setsubscriptionxactseqno 是否对您有用?

您还可以使用分发代理参数-SkipErrors 8114暂时跳过此错误类型。

跳过事务复制中的错误

于 2012-02-23T08:41:49.767 回答