Conflicts in subscriber in Merge Repl

  • I need some help trouble shooting a problem with conflicts occuring during a merge.  I get these sporadically when the agent synchs:

    The row was inserted at <publisher> but could not be inserted at <subscriber>. INSERT statement conflicted with COLUMN FOREIGN KEY constraint <Foreign key name>. The conflict occurred in database <repl database>, table <table name>, column <primary key name>.

    What kinds of things can cause this.  When I check the publisher it has all the data, but obviously when I check the subscriber, it is missing the data that shows in the conflict.  Any help on this would be appreciated. 

    It's almost as if it's trying to push the child records before the parent records when it synchs up. 

    BTW - we do have identity columns in these tables (which are scripted with the NOT FOR REPLICATION option) and we use identity ranges.

    Also, does anybody have a good reference for replication other than BOL?

    TIA,

    Angela

  • FYI - I found this on microsoft.public.sqlserver.replication newsgroup:

    try increasing the -UploadGenerationsPerBatch

    and -DownloadGenerationsPerBatch Merge Agent parameters to their maximum

    value of 2000, which virtually eliminates the possibility of processing a

    child article's generation in a batch separate from the parent article's

    generation

    HTH,

    Paul Ibison

    (recommended sql server 2000 replication book:

    http://www.nwsu.com/0974973602p.html)

    If the above setting doesn't work, it was suggested to try scripting the foreign keys with NOT FOR REPLICATION option.

    So far the setting is working for me.

  • Two things could be possible for this problem

    a) Foreign keys should be set "Not for replication"

    b) Some rows are inserted either at the publisher or subscriber. Since the row was not in sync and an update which is made subsequent to this, caused this error

    I suspect b above is your problem.

    hope this helps

     

    k2

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply