sp_addpushsubscription_agent (Transact-SQL)
SQL Server 2008 R2
加入一項新排程的代理程式作業,以便用來同步處理發送訂閱與交易式發行集。這個預存程序執行於發行集資料庫的發行者端。
安全性注意事項 |
|---|
當利用遠端散發者來設定發行者時,提供給所有參數的值 (包括 job_login 和 job_password) 都會以純文字的方式傳給散發者。您應該先加密「發行者」及其遠端「散發者」之間的連接,再執行這個預存程序。如需詳細資訊,請參閱<加密 SQL Server 的連接>。 |
sp_addpushsubscription_agent [ @publication= ] 'publication'
[ , [ @subscriber = ] 'subscriber' ]
[ , [ @subscriber_db = ] 'subscriber_db' ]
[ , [ @subscriber_security_mode = ] subscriber_security_mode ]
[ , [ @subscriber_login = ] 'subscriber_login' ]
[ , [ @subscriber_password = ] 'subscriber_password' ]
[ , [ @job_login = ] 'job_login' ]
[ , [ @job_password = ] 'job_password' ]
[ , [ @job_name = ] 'job_name' ]
[ , [ @frequency_type = ] frequency_type ]
[ , [ @frequency_interval = ] frequency_interval ]
[ , [ @frequency_relative_interval = ] frequency_relative_interval ]
[ , [ @frequency_recurrence_factor = ] frequency_recurrence_factor ]
[ , [ @frequency_subday = ] 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 ]
[ , [ @dts_package_name = ] 'dts_package_name' ]
[ , [ @dts_package_password = ] 'dts_package_password' ]
[ , [ @dts_package_location = ] 'dts_package_location' ]
[ , [ @enabled_for_syncmgr = ] 'enabled_for_syncmgr' ]
[ , [ @distribution_job_name = ] 'distribution_job_name' ]
[ , [ @publisher = ] 'publisher' ]
[ , [ @subscriber_provider = ] 'subscriber_provider' ]
[ , [ @subscriber_datasrc = ] 'subscriber_datasrc' ]
[ , [ @subscriber_location = ] 'subscriber_location' ]
[ , [ @subscriber_provider_string = ] 'subscriber_provider_string' ]
[ , [ @subscriber_catalog = ] 'subscriber_catalog' ]
-- 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". DECLARE @publication AS sysname; DECLARE @subscriber AS sysname; DECLARE @subscriptionDB AS sysname; SET @publication = N'AdvWorksProductTran'; SET @subscriber = $(SubServer); SET @subscriptionDB = N'AdventureWorks2008R2Replica'; --Add a push subscription to a transactional publication. USE [AdventureWorks2008R2] EXEC sp_addsubscription @publication = @publication, @subscriber = @subscriber, @destination_db = @subscriptionDB, @subscription_type = N'push'; --Add an agent job to synchronize the push subscription. EXEC sp_addpushsubscription_agent @publication = @publication, @subscriber = @subscriber, @subscriber_db = @subscriptionDB, @job_login = $(Login), @job_password = $(Password); GO
安全性注意事項