SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


subscriber''s records disappear with merge replication


subscriber''s records disappear with merge replication

Author
Message
David Poluxt
David Poluxt
Valued Member
Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)

Group: General Forum Members
Points: 59 Visits: 95

Hello everyone,

I am struggling with getting a merge replication working. On the publisher, I have an empty table. The subscriber has a table of the exact same structure, with 1 record. When I engage a subscription, instead of the seeing the 1 record go up to the publisher, the subscription instead wipes out the record on the subscriber! Obviously, this is not the way merge is supposed to work, and it must be something simple I'm doing wrong. Thanks in advance for any help!


Paul Mu
Paul Mu
Mr or Mrs. 500
Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)

Group: General Forum Members
Points: 581 Visits: 391

When synchronisation occurs b/w a Publisher and a Subscriber, the merge agent will determine which data will be propagated to where in order to achieve Data Convergence. In this instance, the Publisher's higher priority determines that the subscriber's data would have to be removed.


David Poluxt
David Poluxt
Valued Member
Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)

Group: General Forum Members
Points: 59 Visits: 95

This leads to 2 questions, then:

1) If I start out with both tables empty, engage the subscription, and *then* add the record to the subscriber, the record propagates to the publisher instead of disappearing. So why does my replication work properly in this instance?

2) You mention data convergence and the publisher's priority. Is there a way to change the settings for the publisher's priority?

Thanks


Paul Mu
Paul Mu
Mr or Mrs. 500
Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)

Group: General Forum Members
Points: 581 Visits: 391

One important thing to realise is that Merge Replication (MR) requires that both the publisher and subscriber databases are in sync. This is achieved through the application of a snap-shot file or through 'forced-replication' (search this site to found out more) if the databases contain different datasets initially.

If synchronisation starts and the two databases are different, then MR will perform a delete in the subscribing database, as in your case, to make the subscriber to be in-sync with the publisher. Once both databases are in-sync (both tables are clean), then adding records in either the subscriber or publisher will be propagated to the other. This is the two-way nature of MR.


Aaron-296258
Aaron-296258
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 5

In replication, i believe the data has to be in sync first before any replication can take place. Is this correct?


David Poluxt
David Poluxt
Valued Member
Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)

Group: General Forum Members
Points: 59 Visits: 95

Good question! *Does* the publisher have to be in sync with the subscriber before replication can begin?

In my case, I have a publisher and subscriber who are (very) out of sync, and I was hoping to use replication to get them in sync. The publisher has some records the subscriber does not, the subscriber has some records the publisher does not, and they both have some records in common. Using merge replication, I was hoping that the subscriber's new records would go up to the publisher, the publisher's new records would come down to the subscriber, and that no records would be lost. Is this do-able with merge replication?

Thank you!


David Poluxt
David Poluxt
Valued Member
Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)Valued Member (59 reputation)

Group: General Forum Members
Points: 59 Visits: 95

Ooops.....I guess I should have read your previous reply more closely. I see you do clearly say that both subscriber and publisher must be in sync before replication begins.

So that leaves the question: is there any way to use replication to get the subscriber & publisher in sync with each other--without losing any records?

Thanks again.


Aaron-296258
Aaron-296258
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 5

I believe that the initial snapshot is for this purpose. However I believe that the subscriber will be made the same as the publisher. This means that subscriber will become a copy of the publisher and not merge their data together. To do that, might need a third party software i think.

Aaron

Learning never stops.


Paul Mu
Paul Mu
Mr or Mrs. 500
Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)Mr or Mrs. 500 (581 reputation)

Group: General Forum Members
Points: 581 Visits: 391

Yes that is correct! A snapshot file is one way to create an exact copy at the subscriber for merge replication.

The approach to making exact copies of two databases would depend on whether you have existing data in one or both databases. If both databases have data, then you will have to somehow get them to be the same, which simply involves copying from one to the other. Watch out for identity columns, which may require you to set different identity ranges for each database.


Aaron-296258
Aaron-296258
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 5

pardon me, snapshot is not able to solve the problem where there are some data in server A and some data in server B which i like to keep. Does it? Cause i believe snapshot is bulk copy.


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search