修复 SQL Server 2005 中损坏的事务复制
我已经在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊啊,看看
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 indistribution
database, wheresp_helpsubscriptionerrors
has to be executed)...but this isn't documented in MSDN.在订阅者上执行 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