sp_addpullsubscription_agent (Transact-SQL)
SQL Server 2008 R2
加入一項新排程的代理程式作業,以便用來同步處理提取訂閱與交易式發行集。這個預存程序執行於訂閱資料庫的訂閱者端。
sp_addpullsubscription_agent [ @publisher = ] 'publisher'
[ , [ @publisher_db = ] 'publisher_db' ]
, [ @publication = ] 'publication'
[ , [ @subscriber = ] 'subscriber' ]
[ , [ @subscriber_db = ] 'subscriber_db' ]
[ , [ @subscriber_security_mode = ] subscriber_security_mode ]
[ , [ @subscriber_login = ] 'subscriber_login' ]
[ , [ @subscriber_password = ] 'subscriber_password' ]
[ , [ @distributor = ] 'distributor' ]
[ , [ @distribution_db = ] 'distribution_db' ]
[ , [ @distributor_security_mode = ] distributor_security_mode ]
[ , [ @distributor_login = ] 'distributor_login' ]
[ , [ @distributor_password = ] 'distributor_password' ]
[ , [ @optional_command_line = ] 'optional_command_line' ]
[ , [ @frequency_type = ] frequency_type ]
[ , [ @frequency_interval = ] frequency_interval ]
[ , [ @frequency_relative_interval = ] frequency_relative_interval ]
[ , [ @frequency_recurrence_factor = ] frequency_recurrence_factor ]
[ , [ @frequency_subda y= ] frequency_subday ]
[ , [ @frequency_subday_interval = ] frequency_subday_interval ]
[ , [ @active_start_time_of_day = ] active_start_time_of_day ]
[ , [ @active_end_time_of_day = ] active_end_time_of_day ]
[ , [ @active_start_date = ] active_start_date ]
[ , [ @active_end_date = ] active_end_date ]
[ , [ @distribution_jobid = ] distribution_jobid OUTPUT ]
[ , [ @encrypted_distributor_password = ] encrypted_distributor_password ]
[ , [ @enabled_for_syncmgr = ] 'enabled_for_syncmgr' ]
[ , [ @ftp_address = ] 'ftp_address' ]
[ , [ @ftp_port = ] ftp_port ]
[ , [ @ftp_login = ] 'ftp_login' ]
[ , [ @ftp_password = ] 'ftp_password' ]
[ , [ @alt_snapshot_folder = ] 'alternate_snapshot_folder' ]
[ , [ @working_directory = ] 'working_directory' ]
[ , [ @use_ftp = ] 'use_ftp' ]
[ , [ @publication_type = ] publication_type ]
[ , [ @dts_package_name = ] 'dts_package_name' ]
[ , [ @dts_package_password = ] 'dts_package_password' ]
[ , [ @dts_package_location = ] 'dts_package_location' ]
[ , [ @reserved = ] 'reserved' ]
[ , [ @offloadagent = ] 'remote_agent_activation' ]
[ , [ @offloadserver = ] 'remote_agent_server_name']
[ , [ @job_name = ] 'job_name' ]
[ , [ @job_login = ] 'job_login' ]
[ , [ @job_password = ] 'job_password' ]
-- This script uses sqlcmd scripting variables. They are in the form -- $(MyVariable). For information about how to use scripting variables -- on the command line and in SQL Server Management Studio, see the -- "Executing Replication Scripts" section in the topic -- "Programming Replication Using System Stored Procedures". -- Execute this batch at the Subscriber. DECLARE @publication AS sysname; DECLARE @publisher AS sysname; DECLARE @publicationDB AS sysname; SET @publication = N'AdvWorksProductTran'; SET @publisher = $(PubServer); SET @publicationDB = N'AdventureWorks2008R2'; -- At the subscription database, create a pull subscription -- to a transactional publication. USE [AdventureWorks2008R2Replica] EXEC sp_addpullsubscription @publisher = @publisher, @publication = @publication, @publisher_db = @publicationDB; -- Add an agent job to synchronize the pull subscription. EXEC sp_addpullsubscription_agent @publisher = @publisher, @publisher_db = @publicationDB, @publication = @publication, @distributor = @publisher, @job_login = $(Login), @job_password = $(Password); GO