Aracılığıyla paylaş


sp_addpushsubscription_agent (Transact-SQL)

Eşitlemek için kullanılan yeni bir zamanlanmış Aracısı iş ekler bir gönderme temelli abonelik bir işlem yayın için.Bu saklı yordam, yayın veritabanı üzerinde yayımcı adresindeki yürütülür.

Güvenlik notuGüvenlik Notu

Yayımcı ile yapılandırırken bir uzak Dağıtımcı, sağlanan da dahil olmak üzere tüm parametreler için değerler job_login ve job_password, için dağıtıcı düz metin olarak gönderilirBu saklı yordam yürütmeden önce Yayımcı ve kendi uzak dağıtımcı arasında bağlantı şifrelemek.Daha fazla bilgi için bkz: SQL Server bağlantıları şifreleme.

Konu bağlantısı simgesiTransact-sql sözdizimi kuralları

Sözdizimi

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' ]

Bağımsız değişkenler

  • [ @publication =] 'publication'
    Is the name of the publication.publication is sysname, with no default.

  • [ @subscriber =] 'subscriber'
    Is the name of the Subscriber.subscriber is sysname, with a default of NULL.

  • [ @subscriber_db =] 'subscriber_db'
    Is the name of the subscription database.subscriber_db is sysname, with a default of NULL.Bir olmayan - sql Server abone için değeri belirtmek (varsayılan hedef) için subscriber_db.

  • [ @subscriber_security_mode =] subscriber_security_mode
    Is the security mode to use when connecting to a Subscriber when synchronizing.subscriber_security_mode is int, with a default of 1.0 belirtir SQL Server kimlik doğrulaması.1 Windows kimlik doğrulamasının kullanılacağını belirtir.

    Güvenlik notuGüvenlik Notu

    Kuyruğa alınmış güncelleştirme abonelikleri için kullanmak SQL Server , abonelere bağlantılar için kimlik doğrulaması ve her abone. bağlantı için farklı bir hesap belirtmekDiğer tüm abonelikler için Windows kimlik doğrulaması kullanın.

  • [ @subscriber_login =] 'subscriber_login'
    Ne zaman kullanmak için abone oturum açma için bir abone eşitlerken bağlanıyor. subscriber_login olan sysname, varsayılan değer null.

  • [ @subscriber_password =] 'subscriber_password'
    Is the Subscriber password.subscriber_password is required if subscriber_security_mode is set to 0.subscriber_password is sysname, with a default of NULL.Abone parola kullanılırsa, otomatik olarak şifrelenir.

    Güvenlik notuGüvenlik Notu

    Boş parola kullanmayın.Güçlü bir parola kullanın.Mümkün olduğunda, zamanında güvenlik kimlik bilgileri bilgilerini girmesini ister.Bir komut dosyasında kimlik bilgileri bilgilerini depolamak, yetkisiz erişimi önlemek için dosyayı güvenli gerekir.

  • [ @job_login = ] 'job_login'
    Is the login for the Windows account under which the agent runs.job_login is nvarchar(257), with a default value of NULL.Bu Windows hesabını her zaman Aracısı bağlantıları dağıtımcı ve abone bağlantıları için tümleşik Windows kimlik doğrulaması kullanılırken kullanılır.

  • [ @job_password = ] 'job_password'
    Is the password for the Windows account under which the agent runs.job_password is sysname, with no default.

    Güvenlik notuGüvenlik Notu

    Mümkün olduğunda, zamanında güvenlik kimlik bilgileri bilgilerini girmesini ister.Bir komut dosyasında kimlik bilgileri bilgilerini depolamak, yetkisiz erişimi önlemek için dosyayı güvenli gerekir.

  • [ @job_name = ] 'job_name'
    Is the name of an existing agent job.job_name is sysname, with a default value of NULL.Bu parametre yalnızca olur ne zaman belirtilen abonelik (varsayılan) yeni oluşturulan iş yerine varolan bir işi kullanarak eşitlenir.Üye değilseniz, sysadmin sabit sunucu rolü, belirttiğiniz gerekir job_login ve job_password , belirttiğiniz job_name.

  • [ @frequency_type = ] frequency_type
    Is the frequency with which to schedule the Distribution Agent.frequency_type is int, and can be one of the following values.

    Değer

    Açıklama

    1

    Birisaat

    2

    İsteğe bağlı

    4

    Günlük

    8

    Haftalık

    16

    Aylık

    32

    Aylık göreli

    64 (varsayılan)

    Otomatik başlatma

    128

    Yinelenen

    Not

    Değeri belirterek 64 sürekli modunda çalıştırmak Dağıtım Aracısı olur.Bu ayara karşılık gelir -sürekli Aracısı parametresi.Daha fazla bilgi için bkz: Çoğaltma Dağıtım Aracısı.

  • [ @frequency_interval = ] frequency_interval
    Is the value to apply to the frequency set by frequency_type.frequency_interval is int, with a default of 1.

  • [ @frequency_relative_interval = ] frequency_relative_interval
    Olan tarih Dağıtım Aracısı.This parameter is used when frequency_type is set to 32 (monthly relative).frequency_relative_interval is int, and can be one of the following values.

    Değer

    Açıklama

    1 (varsayılan)

    First

    2

    İkinci

    4

    Üçüncü

    8

    Dördüncü

    16

    Last

  • [ @frequency_recurrence_factor = ] frequency_recurrence_factor
    Is the recurrence factor used by frequency_type.frequency_recurrence_factor is int, with a default of 0.

  • [ @frequency_subday = ] frequency_subday
    Is how often to reschedule during the defined period.frequency_subday is int, and can be one of the following values.

    Değer

    Açıklama

    1

    Bir kez

    2

    İkinci

    4 (varsayılan)

    Dakika

    8

    Saat

  • [ @frequency_subday_interval = ] frequency_subday_interval
    Is the interval for frequency_subday.frequency_subday_interval is int, with a default of 5.

  • [ @active_start_time_of_day = ] active_start_time_of_day
    Is the time of day when the Distribution Agent is first scheduled, formatted as HHMMSS.active_start_time_of_day is int, with a default of 0.

  • [ @active_end_time_of_day = ] active_end_time_of_day
    Is the time of day when the Distribution Agent stops being scheduled, formatted as HHMMSS.active_end_time_of_day is int, with a default of 235959.

  • [ @active_start_date = ] active_start_date
    Is the date when the Distribution Agent is first scheduled, formatted as YYYYMMDD.active_start_date is int, with a default of 0.

  • [ @active_end_date = ] active_end_date
    Is the date when the Distribution Agent stops being scheduled, formatted as YYYYMMDD.active_end_date is int, with a default of 99991231.

  • [ @dts_package_name = ] 'dts_package_name'
    Specifies the name of the Data Transformation Services (DTS) package.dts_package_name is a sysname with a default of NULL.Örneğin, paket adını belirtmek için DTSPub_Package, parametre olacak @dts_package_name = N'DTSPub_Package'.

  • [ @dts_package_password = ] 'dts_package_password'
    Specifies the password required to run the package.dts_package_password is sysname with a default of NULL.

    Not

    Size bir parola belirtmelisiniz dts_package_name belirtilir.

  • [ @dts_package_location = ] 'dts_package_location'
    Specifies the package location.dts_package_location is a nvarchar(12), with a default of DISTRIBUTOR.Paket konumunu olabilir dağıtımcı veya abone.

  • [ @enabled_for_syncmgr = ] 'enabled_for_syncmgr'
    Abonelik yoluyla mı eşitlenebilir olup Microsoft Eşitleme Yöneticisi. enabled_for_syncmgr olan nvarchar(5), varsayılan değer false.If false, the subscription is not registered with Synchronization Manager.If true, the subscription is registered with Synchronization Manager and can be synchronized without starting SQL Server Management Studio.

  • [ @distribution_job_name = ] 'distribution_job_name'
    Yalnızca bilgi amaçlı olarak belirtilmiştir. Desteklenmez. Gelecekteki uyumluluk garanti edilmez.

  • [ @publisher = ] 'publisher'
    Is the name of the Publisher.publisher is sysname, with a default value of NULL.

  • [ @subscriber_provider= ] 'subscriber_provider'
    Is the unique programmatic identifier (PROGID) with which the OLE DB provider for the non-SQL Server data source is registered.subscriber_provider is sysname, with default value of NULL.subscriber_provider must be unique for the OLE DB provider installed on the Distributor.subscriber_provider is only supported for non-SQL Server Subscribers.

  • [ @subscriber_datasrc= ] 'subscriber_datasrc'
    Is the name of the data source as understood by the OLE DB provider.subscriber_datasrc is nvarchar(4000), with a default value of NULL.subscriber_datasrc is passed as the DBPROP_INIT_DATASOURCE property to initialize the OLE DB provider.subscriber_datasrc is only supported for non-SQL Server Subscribers.

  • [ @subscriber_location= ] 'subscriber_location'
    Is the location of the database as understood by the OLE DB provider.subscriber_location is nvarchar(4000), with a default value of NULL.subscriber_location is passed as the DBPROP_INIT_LOCATION property to initialize the OLE DB provider.subscriber_location is only supported for non-SQL Server Subscribers.

  • [ @subscriber_provider_string= ] 'subscriber_provider_string'
    Is the OLE DB provider-specific connection string that identifies the data source.subscriber_provider_string is nvarchar(4000), with a default value of NULL.subscriber_provider_string is passed to IDataInitialize or set as the DBPROP_INIT_PROVIDERSTRING property to initialize the OLE DB provider.subscriber_provider_string is only supported for non-SQL Server Subscribers.

  • [ @subscriber_catalog= ] 'subscriber_catalog'
    Is the catalog to be used when making a connection to the OLE DB provider.subscriber_catalog is sysname, with default value of NULL.subscriber_catalog is passed as the DBPROP_INIT_CATALOG property to initialize the OLE DB provider.subscriber_catalog is only supported for non-SQL Server Subscribers.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (başarısız)

Açıklamalar

sp_addpushsubscription_agent anlık görüntü çoğaltması çoğaltması çoğaltma ve işlem çoğaltma kullanılır.

Örnek

-- 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

İzinler

Yalnızca üyeleri sysadmin sabit sunucu rolü veya db_owner sabit veritabanı rolü olabilir yürütmek sp_addpushsubscription_agent.