Replication--使用备份初始化订阅--推送订阅

1. 修改发布属性"许从备份文件初始化"置为TRUE
2. 备份数据库并在订阅服务器上还原
3. 创建订阅

----------------------------------------------------------
-----------------在发布服务器上运行的脚本-----------------
use [DB01]
exec sp_addsubscription
@publication = N'DB01_REP1',
@subscriber = N'SQLVM5',
@destination_db = N'DB01',
@subscription_type = N'Push',
@sync_type = N'initialize with backup',
@article = N'all',
@update_mode = N'read only',
@subscriber_type = 0,
@backupdevicetype='disk',
@backupdevicename='F:\DB01_03.trn'--最后一次备份的备份文件(发布服务器上的存放位置)

exec sp_addpushsubscription_agent
@publication = N'DB01_REP1',
@subscriber = N'SQLVM5',
@subscriber_db = N'DB01',
@job_login = null,
@job_password = null,
@subscriber_security_mode = 0,
@subscriber_login = N'sa',
@subscriber_password = '1234%^&*gg',
@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 = 20131028,
@active_end_date = 99991231,
@enabled_for_syncmgr = N'False',
@dts_package_location = N'Distributor'
GO
 

posted on 2014-01-15 17:25  笑东风  阅读(578)  评论(0编辑  收藏  举报

导航