开发者

Disable SQL Server replication via command line or batch file, then re-enable

开发者 https://www.devze.com 2023-04-03 11:54 出处:网络
We are using a continuous integration process, and one of the steps for that is to sy开发者_StackOverflow中文版nchronize the databases.For that, we\'ve selected RedGate software that will analyze two

We are using a continuous integration process, and one of the steps for that is to sy开发者_StackOverflow中文版nchronize the databases. For that, we've selected RedGate software that will analyze two databases and generate the necessary scripts. However, we have SQL replication running on these databases and therefore many of the scripts are prohibited by SQL Server due to the replication.

Is there a way we can temporarily disable/pause replication so we can run the transformation scripts, and then enable replication again after the script has been executed? Or, if anyone has an alternative suggestion, we're all ears!


Look at what the scripts that Red Gate is producing are doing. Often times, they do stuff because it makes the script less likely to fail in the general case, whereas that protection might not be necessary in your environment.

However, if everything in the Red Gate script must stay, your only option is to remove the article, do your change, and then re-add it. sp_droparticle and sp_addarticle are your friend here.

0

精彩评论

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