sp_reinitmergesubscription (języka Transact-SQL)

Znaczniki subskrypcja scalania dla następnego ponownego zainicjowania czas Agent korespondencji seryjnej jest uruchamiany.Ta procedura składowana jest wykonywany Wydawca w baza danych publikacja.

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

Składnia

sp_reinitmergesubscription [ [ @publication = ] 'publication'
    [ , [ @subscriber = ] 'subscriber'
    [ , [ @subscriber_db = ] 'subscriber_db'
    [ , [ @upload_first = ] 'upload_first'

Argumenty

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

  • [ @ subskrybent = 'subscriber"
    Is the name of the Subscriber.subscriber is sysname, with a default of all.

  • [ @ subscriber_db = 'subscriber_db"
    Is the name of the Subscriber database.subscriber_db is sysname, with a default of all.

  • [ @ upload_first = 'upload_first"
    Is whether changes at the Subscriber are uploaded before the subscription is reinitialized.upload_first is nvarchar(5), with a default of FALSE.Jeśli true, zmiany są przekazywane przed ustawienie ponownie inicjowane subskrypcja.Jeśli false, zmiany nie są przekazywane.

Wartości kodów powrotnych

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

Uwagi

sp_reinitmergesubscription używane w replikacja scalająca.

sp_reinitmergesubscription może być wywołana z Wydawca, aby ponownie zainicjować subskrypcje korespondencji seryjnej.Zaleca się, uruchom ponownie przez agenta migawki.

Jeśli dodawanie, drop lub zmienić filtr sparametryzowana oczekujące zmiany subskrybent nie można przekazać do Wydawca podczas ponownego inicjowania.Jeśli chcesz przekazać oczekujące zmiany, należy zsynchronizować wszystkie subskrypcje przed zmianą filtru.

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 @subscriptionDB AS sysname;
DECLARE @publication AS sysname;
SET @subscriptionDB = N'AdventureWorks2008R2Replica';
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorks2008R2Replica]

-- Execute at the Publisher to reinitialize the push subscription. 
-- Pending changes at the Subscrber are lost.
EXEC sp_reinitmergesubscription 
    @subscriber = $(SubServer),
    @subscriber_db = @subscriptionDB,
    @publication = @publication,
    @upload_first = N'false';
GO

-- Start the Merge Agent.

-- 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 @subscriptionDB AS sysname;
DECLARE @publication AS sysname;
SET @subscriptionDB = N'AdventureWorks2008R2Replica';
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorks2008R2Replica]

-- Execute at the Publisher to reinitialize the push subscription, 
-- and upload pending changes at the Subscriber. 
EXEC sp_reinitmergesubscription 
    @subscriber = $(SubServer),
    @subscriber_db = @subscriptionDB,
    @publication = @publication,
    @upload_first = N'true';
GO

-- Start the Merge Agent.

Uprawnienia

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