修复 SQL Server 2005 中损坏的事务复制

发布于 2025-01-08 17:40:08 字数 1180 浏览 4 评论 0原文

我已经在 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
[...]

并且我使用结果 (0x00139791000CC79C000600000000) 中的 xact_seqno 在下一步中执行以下过程,

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

其中将显示:

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

啊?

I've set-up a transactional replication in SQL Server 2005 and I've disabled the DDL trigger that were created when setting up replication. After playing a bit (to understand what will happen) the transaction is broken, because I've changed a column on publisher to VARCHAR that is INT on subscriber. I've found two procedure, which will help to skip this buggy transaction

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

That gives me a resultset where I can see the error (failure on converting VARCHAR to 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
[...]

and I use the xact_seqno from result (0x00139791000CC79C000600000000) to execute following procedure in next step

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

which will say:

Error 20017 - The subscription doesn't exist on subscriber.

Huh?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

潜移默化 2025-01-15 17:40:08

啊啊,看看sp_setsubscriptionxactseqno内部代码 code> 可以看出,该过程必须在订阅数据库中执行(而不是在分发数据库中执行,其中必须执行 sp_helpsubscriptionerrors)...但这在 MSDN 中没有记录。

Ahhhh, having a look at internal code of sp_setsubscriptionxactseqno one can see, that this procedure has to be executed in the subscription database (and not in distribution database, where sp_helpsubscriptionerrors has to be executed)...but this isn't documented in MSDN.

写下不归期 2025-01-15 17:40:08

在订阅者上执行 sp_setsubscriptionxactseqno 对您有用吗?

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

跳过事务复制中的错误

Did executing sp_setsubscriptionxactseqno on the subscriber work for you?

You can also use the Distribution Agent parameter -SkipErrors 8114 to temporarily skip this error type.

Skipping Errors in Transactional Replication

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文