Error in merge replication : Violation of UNIQUE KEY constraint ''unique_pubsrvdb''

  • Hi everyone,

    I have a VB application thru which I am pulling the subscriptions from the Server. I have a distributed environment and every client should transfer there data to the server at some periodic  timings.

    The details for the databases are as:

    1)Publisher : SQL SERVER 2005

    2)Subscriber : MSDE sp4

    Case 1:

    When i created one publication 'TEST1' and configured at Client for pull subscription then it will work after that i prepare a second publication 'TEST2' and same steps done for 'TEST2' then it also work.

    Case 2:

    When i created two publications 'TEST1' and 'TEST2' and configured at Client for pull subscription then first publication any of the one it will work the other subscriation it will not work. It will raise following error on Client side

    The ERROR messages are like :

    1)Violation of UNIQUE KEY constraint 'unique_pubsrvdb'. Cannot insert duplicate key in object 'sysmergesubscriptions'."

    2){call sp_MSaddinitialpublication (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?, ?)}"

    3)The merge process could not initialize the subscription

    I found on internet that PUSH subscription will solve it some how, but I don't want to go for PUSH subscriptions.

    If you have any idea then please pass to me.

    Thanks in advance.

     

     

     

     

     

  • Sounds to me like you have data being updated at both subscribers with the same data. This same data, on synchronisation, returns the error.

    Or have I misread your post?

    Typically, you need to start resolving this problem by looking at the UNIQUE KEY 'unique_pubsrvdb' and finding out what is unique about it.

    Then you might be able to tell what is going on.


    Regards,

    Steve

    Life without beer is no life at all

    All beer is good, some beers are just better than others

  • Hi, Steve,

    Actually there is no such thing as you are thinking.

    The error raised in a system table named " sysmergesubscriptions"

    when I take one subscription out of two then there is an entry of both the subscription in this system table. So when I am getting the other publication from the server then it is given me an error of UNIQUE key as there is allready a key present which come with the first publication from the server.

    So I dont want to take the entry in the sysmergesubscription table at the client side. This will solve my problem if I do so.

    On the other in the system table named " sysmergepublications" the entries are perfect.

    with regards,

    Loku

     

     

  • From what I can see when I look at my server, there is a constraint - as listed below

    CONSTRAINT [unique_pubsrvdb] UNIQUE NONCLUSTERED

    (

    [pubid] ASC,

    [subscriber_server] ASC,

    [db_name] ASC

    )

    This is a unique constraint on the sysmergesubscriptions table.

    It looks like this is happening when you go to create the second publication - or is it when you create the second subscription. Either way, re-check the values that you are using to create either to ensure uniqueness.


    Regards,

    Steve

    Life without beer is no life at all

    All beer is good, some beers are just better than others

  • Hi.

    We are facing the exact same problem at one of our large customers.... Cand find the solution to this problem either....

    any one having good ideas about what to do?

  • you need to remove the offending row from sysmergepublications

    once this is removed replication will work

    sometimes when you drop subscriptions SQL doesn't do a very good job of cleaning out all the offending rows

Viewing 6 posts - 1 through 5 (of 5 total)

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