由于业务需要,我可能需要在我的环境中禁用事务性复制(SQL2k -> Sql 2008)。在功能上,我理解这意味着我需要删除订阅和文章。当冲突的需求得到解决时,创建脚本是否足以将复制恢复到原始状态?
谢谢。
发布于 2012-02-14 15:38:10
我使用Server 2000 (MS2000)作为发布服务器和Server 2008 (MS2008 )作为订阅服务器测试此示例。在发布服务器上,一个名为arp的数据库有几个表,但只有表用户作为项目包含在出版物中。此示例从两个服务器中删除订阅,然后再将其放回。
订阅服务器上的
删除了现有订阅。
USE arp
GO
EXEC sp_droppullsubscription @publisher='MS2000', @publisher_db='arp', @publication='arp_pub'
发布服务器上的
-- dropped subscription
exec sp_dropsubscription @publication = N'Arp_pub', @subscriber = N'MS2008', @destination_db = N'arp', @article = N'all'
-- On MS2000, dropped subscriber from MS2008 after removing it from MS2008
exec sp_dropsubscriber @subscriber = N'MS2008'
稍后,我重新创建订阅。
出版商的
中添加
use [master]
exec sp_addsubscriber @subscriber = N'MS2008', @type = 0, @description = null, @security_mode = 1, @frequency_type = 64, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 4, @frequency_subday_interval = 5, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 99991231
exec sp_changesubscriber_schedule @agent_type = 1, @subscriber = N'MS2008', @frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8, @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 99991231
GO
中添加
use [Arp]
exec sp_addsubscription @publication = N'Arp_pub', @subscriber = N'MS2008', @destination_db = N'arp', @sync_type = N'Automatic', @subscription_type = N'pull', @update_mode = N'read only'
GO
订阅服务器上的
CREATE DATABASE arp;
GO
use [arp]
exec sp_addpullsubscription @publisher = N'MS2000', @publication = N'Arp_pub', @publisher_db = N'Arp', @independent_agent = N'False', @subscription_type = N'pull', @description = N'', @update_mode = N'read only', @immediate_sync = 0
@job_login是一个ntlm用户,它具有默认快照文件夹的权限。该用户还可以访问发布服务器上的出版物。
快照文件夹是发布服务器和订阅服务器都可以访问的共享文件夹。
exec sp_addpullsubscription_agent @publisher = N'MS2000', @publisher_db = N'Arp', @publication = N'Arp_pub', @distributor = N'MS2000', @distributor_security_mode = 1, @distributor_login = N'', @distributor_password = null, @enabled_for_syncmgr = N'False', @frequency_type = 64, @frequency_interval = 0, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 20120214, @active_end_date = 99991231, @alt_snapshot_folder = N'', @working_directory = N'', @use_ftp = N'False', @job_login = N'MS2008\replication_user', @job_password = 'test123', @publication_type = 0
GO
复制的表在MS2008上再次可见。
https://dba.stackexchange.com/questions/12980
复制相似问题