开发者

Replication SQL SERVER

In my Production Server i have replication which working fine, i do have Distributed Database which as 开发者_JS百科2 subscriber db . My data is replicated from Production envi (working fine) but while data gets replicated to Distributed database in Subscriber it throws an Error

Err msg =

Replication-Replication Distribution Subsystem: PRD01-XYZ-VREPL1\REPL01-25 failed. Violation of PRIMARY KEY constraint 'PK_vendors'. Cannot insert duplicate key in object 'dbo.tabname'.


I haven't done this in a while, but here is a stab.

First, I wouldn't mind seeing the records which aren't matching, so I would try something like this:

--to be run on the publisher
select pub.*, sub.*
from 
    db_name1.dbo.tabname pub
    JOIN linked_server_to_subscriber.db_name1.dbo.tabname sub
        ON pub.pk = sub.pk
WHERE
    pub.some_field != sub.some_field

Hopefully, for "some_field", there is another unique column, or perhaps a dt_entered, or perhaps a rowguid. :).

  • someone with a very similar problem and some very excellent answers

  • The identity crisis in replication

  • sp_adjustpublisheridentityrange

Finally, if the logic of your situation involves records being inserted into the subscriber table other than by replication, and the type of replication is not merge, you may very well continue to have problems like this.

Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜