Thursday, March 29, 2012

Automating Replication

Hello everyone,
I need some pointers to do the following:
1. I set up a publisher
2. I Set up a distributer
--To have anonymous merge replication.
3. An installer installs MSDE on the client computer if it doesnt
exist.
I want to run something on a client computer thats not on the same
network (via internet), that will automatically setup a database, pull
a subscription from the above distributers and publishers and
synchronize with a given schedule. I want the schedule to be
configurable later. Moreover, the user of the program which uses this
replicated database should be able to click a button and say
Synchronize at any point of time.
What is the best way to achieve this?
1. I saw the MergeX object which is an activeX interface. It doesnt
allow me any interface to change the schedules on the merge agent. It
lets me synchronize though. Is there a hidden interface to access the
merge agent?
2. The SQL-DMO object seemed to allow me to change the schedule, but
it didnt reflect in the current merge agents schedule. The
SQLDMO.SQLServer.Jobs interface didnt show up the current active jobs
(Im assuming a MergeAgentsSchedule should show up here)
foreach(ReplicationDatabase rdb in
s.Replication.ReplicationDatabases)
foreach(MergePullSubscription mps in rdb.MergePullSubscriptions)
mps.MergeJobID
There is a pull subscription visible. But the job Id is
000000000000000 .
In enterprise manager the id is 8 or something like that.
Is SQL-DMO designed to do what im trying to do? or am i missing
something?
3. Is it better to just write an sql script? and call it in code
through a storedprocedure? How Can it be done?
Thanks in advance,
Hananiel
1) no, there is no way to change the scheduling of the merge agent using the
ActiveX controls. Even with plain old merge replication it still farms out
the scheduling to the SQL Server Agent schedule.
2) SQL DMO an ActiveX controls are very different objects. Think of ActiveX
controls as a lightweight SQL DMO. The jobs created through the ActiveX
controls are different and not designed to be managed by SQL DMO, EM (which
uses SQL DMO), or the replication stored procedures. Use another scheduling
agent to schedule your program/script which uses the ActiveX controls or
schedule the program or script using the SQL Server job scheduler.
3) Well you could, but it depends on what you are trying to do. The ActiveX
controls do not offer the functionality that SQL DMO does, and they are
designed in cases where you don't or can't enable the Subscribers through
EM, ie MDSE subscribers, or anonymous subscribers over the internet. The
ActiveX controls also don't support SQL Authentication (IIRC), so you will
have to enter a password each time they run.
HTH
"Hananiel" <hananiel@.yahoo.com> wrote in message
news:e338e321.0409201104.63408961@.posting.google.c om...
> Hello everyone,
> I need some pointers to do the following:
> 1. I set up a publisher
> 2. I Set up a distributer
> --To have anonymous merge replication.
> 3. An installer installs MSDE on the client computer if it doesnt
> exist.
> I want to run something on a client computer thats not on the same
> network (via internet), that will automatically setup a database, pull
> a subscription from the above distributers and publishers and
> synchronize with a given schedule. I want the schedule to be
> configurable later. Moreover, the user of the program which uses this
> replicated database should be able to click a button and say
> Synchronize at any point of time.
> What is the best way to achieve this?
> 1. I saw the MergeX object which is an activeX interface. It doesnt
> allow me any interface to change the schedules on the merge agent. It
> lets me synchronize though. Is there a hidden interface to access the
> merge agent?
> 2. The SQL-DMO object seemed to allow me to change the schedule, but
> it didnt reflect in the current merge agents schedule. The
> SQLDMO.SQLServer.Jobs interface didnt show up the current active jobs
> (Im assuming a MergeAgentsSchedule should show up here)
> foreach(ReplicationDatabase rdb in
> s.Replication.ReplicationDatabases)
> foreach(MergePullSubscription mps in rdb.MergePullSubscriptions)
> mps.MergeJobID
> There is a pull subscription visible. But the job Id is
> 000000000000000 .
> In enterprise manager the id is 8 or something like that.
> Is SQL-DMO designed to do what im trying to do? or am i missing
> something?
> 3. Is it better to just write an sql script? and call it in code
> through a storedprocedure? How Can it be done?
> Thanks in advance,
> Hananiel

No comments:

Post a Comment