开发者

How to programmatically start SQL Server 2005 merge replication

开发者 https://www.devze.com 2022-12-14 12:10 出处:网络
We currently have merge replication set up to merge certain tables between two databases.I need to programmatically start one of the publications to make sure data has been synchronized prior to start

We currently have merge replication set up to merge certain tables between two databases. I need to programmatically start one of the publications to make sure data has been synchronized prior to starting a certain job. SQL Server 开发者_运维技巧Books Online has not been too helpful.

So far, the only thing I have come up with is to use sp_start_job to start the merge replication sql job. Is it ok to do this?

Are there any other ways to programmatically start synchronizing a publication?


We ended up using the sp_start_job with the name of the merge replication publication. The only downside that we found was that the name of the sql job is dynamically generated when the publication is created so if the publication is drop and recreated, then the name will change. Other than that using sp_start_job has worked beautifully.

Couple other things:

  • The sql user was added to SQLAgentOperatorRole to allow the call to sp_start_job
  • sp_help_job was used to indicate if the job completed successfully before proceeding
0

精彩评论

暂无评论...
验证码 换一张
取 消