Tuesday, March 20, 2012

Reinitializing Subscriptions

I am new to SQL Server Replication so I still have a cloud over my
head.
Our target system for a new application is to have a central Sql
Server 2000 SP3 with at least 50 laptops running MSDE 2000 SP3. Mobile
workforce will be updating data offline that will then need to synch
to the master and back down throughout the other laptops (some of it
anyway, dynamic filtering is next on my list). We want to use
anonymous subscriptions.
For testing, I have the Northwind database setup on Windows 2000
running Sql Server 2000 and an XP machine running MSDE. I am using
Visual Studio .NET on the XP machine to go against the ActiveX
Replication objects.
I have successfully setup merge replication. The XP machine uses .NET
code against the SQLMerge ActiveX object to use an anonymous
subscription to pull down data from the publisher. I was able to see
changes made on both databases get merged correctly. I was also able
to see conflicts and see them get resolved correctly.
One area I still fail to understand (and there are many) is
Reinitializing Subscriptions. The scenario I am trying to test is how
we roll out a new release of the existing application -- and in this
case -- changes to the database. I have read and re-read the
Reinitializing Subscriptions in Books Online but I just don't get it.
I changed my publication on the Northwind database to exclude sending
the Picture column in the Categories table. EM told me that all
subscriptions would be marked for reinitialization and that subscriber
data not synchronized first would be lost. So it works as EM and Books
Online say as I lost my data I changed on the laptop (I changed a
description field in the Categories table).
One thing that did not seem to jive with the documentation was that I
tried to synchronize the laptop database before creating the new
snapshot but the SQLMerge.Initialize method received an error saying
the snapshot was not up to date. So I did not have any way of getting
my changed data from the laptop to the server once I had made the
change to the publication.
In our production environment, the laptops will trickle in over time
complicating matters.
But basically, how do I make a change to the database that needs to
get down to the laptops AND preserve the data that has been collecting
on the laptops for weeks?
Crossing my fingers for something built-in,
Gar
There is an option called upload changes to publisher before
reinitialization.
Have a look at this property
Sub ReinitializeSubscription([bUploadBeforeReinit As Boolean = False])
I think you want to set this to True.
What will happen is changes which are pooled on the subscriber are uploaded
to the publisher before the schema changes and the merged data are sent to
the subscriber.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Now available on Amazon.com
http://www.amazon.com/gp/product/off...?condition=all
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"post messages" <post.messages@.gmail.com> wrote in message
news:c45b744b.0502031406.5dbd12bc@.posting.google.c om...
> I am new to SQL Server Replication so I still have a cloud over my
> head.
> Our target system for a new application is to have a central Sql
> Server 2000 SP3 with at least 50 laptops running MSDE 2000 SP3. Mobile
> workforce will be updating data offline that will then need to synch
> to the master and back down throughout the other laptops (some of it
> anyway, dynamic filtering is next on my list). We want to use
> anonymous subscriptions.
> For testing, I have the Northwind database setup on Windows 2000
> running Sql Server 2000 and an XP machine running MSDE. I am using
> Visual Studio .NET on the XP machine to go against the ActiveX
> Replication objects.
> I have successfully setup merge replication. The XP machine uses .NET
> code against the SQLMerge ActiveX object to use an anonymous
> subscription to pull down data from the publisher. I was able to see
> changes made on both databases get merged correctly. I was also able
> to see conflicts and see them get resolved correctly.
> One area I still fail to understand (and there are many) is
> Reinitializing Subscriptions. The scenario I am trying to test is how
> we roll out a new release of the existing application -- and in this
> case -- changes to the database. I have read and re-read the
> Reinitializing Subscriptions in Books Online but I just don't get it.
> I changed my publication on the Northwind database to exclude sending
> the Picture column in the Categories table. EM told me that all
> subscriptions would be marked for reinitialization and that subscriber
> data not synchronized first would be lost. So it works as EM and Books
> Online say as I lost my data I changed on the laptop (I changed a
> description field in the Categories table).
> One thing that did not seem to jive with the documentation was that I
> tried to synchronize the laptop database before creating the new
> snapshot but the SQLMerge.Initialize method received an error saying
> the snapshot was not up to date. So I did not have any way of getting
> my changed data from the laptop to the server once I had made the
> change to the publication.
> In our production environment, the laptops will trickle in over time
> complicating matters.
> But basically, how do I make a change to the database that needs to
> get down to the laptops AND preserve the data that has been collecting
> on the laptops for weeks?
> Crossing my fingers for something built-in,
> Gar
|||Hi Hilary,
Thanks for the reply. Based on what you said I did more searching in
the newsgroup. I found a post that is a little dated, didn't get
promising answers and is still important to the success of trying to
send out database schema upgrades through replication.
Detect Reinitialization is required.
http://groups-beta.google.com/group/...public.sqlser
ver.replication%26q%3DReinitializeSubscription%26q t_g%3D1%26searchnow%3DSearch+this+group%26&_doneTi tle=Back+to+Search&&d#62baf38ab39170d6
Since the laptops are going to have compiled .NET code calling the
merge object, how should they detect that they need to call
ReinitializeSubscription(true) before calling the usual Initialize,
Run, Terminate methods? My understanding is it is wrong to always call
ReinitializeSubscription(true) -- it has to be called only when
necessary.
Thanks,
Gary

No comments:

Post a Comment