sp_addpushsubscription_agent (języka Transact-SQL)

Dodaje nowe zadanie zaplanowane agenta używana do synchronizowania subskrypcja wypychana do publikacja transakcyjnych.Ta procedura składowana jest wykonywany na Wydawca na bazie publikacja.

Uwaga dotycząca zabezpieczeńUwaga dotycząca zabezpieczeń

Podczas konfigurowania Publisher z dystrybutor zdalny, wartości dostarczone dla wszystkich parametrów, łącznie z job_login i job_password, są wysyłane do dystrybutora jako zwykły tekst.Należy zaszyfrować połączenie między wydawcy i jego dystrybutor zdalny przed wykonywania tej procedura składowana.Aby uzyskać więcej informacji, zobacz Szyfrowania połączeńSQL Server.

Ikona łącza do tematuKonwencje składni Transact-SQL

Składnia

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

Argumenty

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

  • [ @ subskrybent = '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.Dla nie - SQL Server subskrybenta, określ wartość (domyślne obiekt obiekt docelowy) dla 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 Określa SQL Server uwierzytelniania.1 Określa uwierzytelnianie systemu Windows.

    Uwaga dotycząca zabezpieczeńUwaga dotycząca zabezpieczeń

    Kolejkowana subskrypcji aktualizacji, należy użyć SQL Server uwierzytelniania dla połączeń abonentów i określić inne konto dla połączenia z każdym subskrybenta.Dla wszystkich innych subskrypcji należy używać uwierzytelniania systemu Windows.

  • [ @ subscriber_login = 'subscriber_login"
    Jest używane podczas logowania subskrybenta nawiązywanie subskrybenta podczas synchronizowania. subscriber_login jest sysname, domyślna wartość 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.Jeśli subskrybent używać hasła, jest automatycznie szyfrowane.

    Uwaga dotycząca zabezpieczeńUwaga dotycząca zabezpieczeń

    Nie należy używać pustego hasła.Należy używać silnego hasła.Jeśli to możliwe, monitują użytkowników o wprowadzenie poświadczenia zabezpieczeń w czasie wykonywania.Jeśli poświadczenia muszą być przechowywane w pliku skryptu, należy zabezpieczyć plik, aby uniemożliwić nieautoryzowany dostęp.

  • [ @ 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.To konto systemu Windows jest zawsze używana dla połączeń agenta do dystrybutora i połączeń subskrybenta podczas używania zintegrowane uwierzytelnianie systemu Windows.

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

    Uwaga dotycząca zabezpieczeńUwaga dotycząca zabezpieczeń

    Jeśli to możliwe, monitują użytkowników o wprowadzenie poświadczenia zabezpieczeń w czasie wykonywania.Jeśli poświadczenia muszą być przechowywane w pliku skryptu, należy zabezpieczyć plik, aby uniemożliwić nieautoryzowany dostęp.

  • [ @ job_name = 'job_name"
    Is the name of an existing agent job.job_name is sysname, with a default value of NULL.Ten parametr jest określony tylko, gdy subskrypcja zostaną zsynchronizowane przy użyciu istniejącego zadania zamiast nowo utworzone zadanie (domyślnie).Jeśli nie są element członkowski z sysadmin ustalona roli serwera, należy określić job_login i job_password podczas określania 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.

    Wartość

    Opis

    1

    Jedenczas

    2

    Na żądanie

    4

    Dzienny

    8

    Tygodniowy

    16

    Miesięczne

    32

    Miesięczne względna

    64 (domyślnie)

    Autostart

    128

    Cykliczne

    Ostrzeżenie

    Określając wartość 64 powoduje, że Agent dystrybucji do uruchamiania w trybie ciągłym.Odpowiada to ustawieniu -ciągłego parametr dla agenta.Aby uzyskać więcej informacji, zobacz Agent replikacji dystrybucji.

  • [ @ 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
    Jest to data agenta dystrybucji.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.

    Wartość

    Opis

    1 (domyślnie)

    First

    2

    Drugie

    4

    Trzecia

    8

    Czwarty

    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.

    Wartość

    Opis

    1

    Raz

    2

    Drugie

    4 (domyślnie)

    Minuta

    8

    Godziny

  • [ @ 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.Na przykład, aby określić nazwę pakiet DTSPub_Package, byłoby parametr @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.

    Ostrzeżenie

    Jeśli musisz określić hasło dts_package_name określono.

  • [ @ dts_package_location = 'dts_package_location"
    Specifies the package location.dts_package_location is a nvarchar(12), with a default of DISTRIBUTOR.Lokalizacja pakiet może być dystrybutor lub subskrybent.

  • [ @ enabled_for_syncmgr = 'enabled_for_syncmgr"
    To, czy subskrypcja mogą być synchronizowane za pośrednictwem Microsoft Menedżera synchronizacji. enabled_for_syncmgr jest nvarchar(5), domyślna wartość FALSE.Jeśli false, subskrypcja nie jest zarejestrowana z Menedżera synchronizacji.Jeśli true, subskrypcja jest zarejestrowany przy użyciu Menedżera synchronizacji i może być synchronizowana bez uruchamiania SQL Server Management Studio.

  • [ @ distribution_job_name = 'distribution_job_name"
    Określone tylko w celach informacyjnych. Nieobsługiwane. Przyszła zgodność nie jest gwarantowana.

  • [ @ 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.

Wartości kodów powrotnych

0 (sukces) lub 1 (błąd)

Uwagi

sp_addpushsubscription_agent w replikacja migawka i replikacja transakcyjna.

Przykład

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

Uprawnienia

Tylko członkowie sysadmin stała rola serwera lub db_owner ustaloną rola bazy danych można wykonać sp_addpushsubscription_agent.