Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

subscriber''s records disappear with merge replication Expand / Collapse
Author
Message
Posted Tuesday, January 24, 2006 2:51 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 08, 2009 3:48 PM
Points: 39, 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!

Post #253227
Posted Tuesday, January 24, 2006 3:56 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:14 AM
Points: 339, Visits: 388

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.

Post #253241
Posted Tuesday, January 24, 2006 5:00 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 08, 2009 3:48 PM
Points: 39, 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

Post #253253
Posted Tuesday, January 24, 2006 9:15 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:14 AM
Points: 339, Visits: 388

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.

Post #253276
Posted Tuesday, January 24, 2006 9:38 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 01, 2009 3:24 AM
Points: 10, Visits: 5

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

 

Post #253282
Posted Wednesday, January 25, 2006 8:24 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 08, 2009 3:48 PM
Points: 39, 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!

Post #253421
Posted Wednesday, January 25, 2006 8:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 08, 2009 3:48 PM
Points: 39, 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.

Post #253429
Posted Wednesday, January 25, 2006 6:25 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 01, 2009 3:24 AM
Points: 10, 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.

Post #253602
Posted Thursday, January 26, 2006 4:35 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:14 AM
Points: 339, Visits: 388

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.

Post #253654
Posted Thursday, January 26, 2006 6:31 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 01, 2009 3:24 AM
Points: 10, 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.

Post #253943
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse