编写复制脚本
我对 SQL Server 事务复制不太了解,但是我是否正确,一旦我们手动创建了想要参与复制的所有文章,我们就可以编写该复制“定义”脚本,以便我们可以禁用复制或者在禁用后启用它,只需执行 T-SQL 脚本?
I don't know too much about SQL Server transactional replication, but am I correct that once we have manually created all the articles we want involved in the replication, we can have that replication 'definition' scripted so that we can either disable the replication or enable it after it's been disable, simply by executing the T-SQL script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您右键单击 SSMS 中的出版物,则会出现“生成脚本...”选项。但要小心:它做的一些事情虽然在技术上是正确的,但却是不直观的,并且可能不会做你想要的事情。我最先想到的一个是 sp_addsubscription 的“@sync_type”参数。我总是看到它被编写为“仅支持复制”,这可能不是您想要的。我想我想说的是在运行脚本之前检查脚本以确保它执行您想要的操作。
If you right-click on the publication in SSMS, there's a "Generate scripts..." option. Be careful though: it does some things that while technically correct are non-intuitive and likely to not do what you want. One that comes to the top of my head is the '@sync_type' parameter to sp_addsubscription. I've always seen it scripted out as "replication support only" which is likely not what you want. I guess what I'm trying to say is to review the script before you run it to make sure that it does what you want it to do.
用于创建发布及其关联订阅的简单 T-SQL 脚本:
http://sqlhint.com/sqlserver/how-to/create -transactional-replication-tsql-script
停用复制的一个选项是启动/停止复制代理。
A simple T-SQL script for creation a publication and its associated subscription:
http://sqlhint.com/sqlserver/how-to/create-transactional-replication-tsql-script
An option to deactivate replication is to start/stop replication agents.