sys.sp_reinitmergepullsubscription (Transact-SQL)

Van toepassing op:SQL Server

Markeert een merge pull-abonnement voor herinitialisatie de volgende keer dat de Merge Agent wordt uitgevoerd. Deze opgeslagen procedure wordt uitgevoerd bij de abonnee in de abonnementsdatabase.

Transact-SQL syntaxis-conventies

Syntax

sys.sp_reinitmergepullsubscription
    [ [ @publisher = ] N'publisher' ]
    [ , [ @publisher_db = ] N'publisher_db' ]
    [ , [ @publication = ] N'publication' ]
    [ , [ @upload_first = ] N'upload_first' ]
[ ; ]

Arguments

[ @publisher = ] N'uitgever'

De naam van de uitgever. @publisher is sysname, met als standaard all.

[ @publisher_db = ] N'publisher_db'

De naam van de Publisher-database. @publisher_db is een systeemnaam, met als standaard all.

[ @publication = ] N'publicatie'

De naam van de publicatie. @publication is een systeemnaam, met als standaard .all

[ @upload_first = ] N'upload_first'

Geeft aan of wijzigingen bij de abonnee worden geüpload voordat het abonnement opnieuw wordt geïntitimiliseerd. @upload_first is nvarchar(5), met een standaard van false.

  • Als true, worden wijzigingen geüpload voordat het abonnement opnieuw wordt geïninitialiseerd.
  • Als false, worden wijzigingen niet geüpload.

Codewaarden retourneren

0 (geslaagd) of 1 (mislukt).

Remarks

sp_reinitmergepullsubscription wordt gebruikt bij merge-replicatie.

Als je een geparametriseerd filter toevoegt, verwijdert of verandert, kunnen in afwachting van wijzigingen bij de abonnee niet worden geüpload naar de Publisher tijdens de herinitialisatie. Als u wachtende wijzigingen wilt uploaden, synchroniseert u alle abonnementen voordat u het filter wijzigt.

Examples

A. Initialiseer het pull-abonnement opnieuw en verlies openstaande wijzigingen

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

USE [AdventureWorks2022Replica]

-- Execute at the Subscriber to reinitialize the pull subscription. 
-- Pending changes at the Subscrber are lost.
EXEC sp_reinitmergepullsubscription 
    @publisher = $(PubServer),
    @publisher_db = @publicationDB,
    @publication = @publication,
    @upload_first = N'false';
GO

-- Start the Merge Agent.

B. Initialiseer het pull-abonnement opnieuw en upload in wachtende wijzigingen

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

USE [AdventureWorks2022Replica]

-- Execute at the Subscriber to reinitialize the pull subscription, 
-- and upload pending changes at the Subscriber. 
EXEC sp_reinitmergepullsubscription 
    @publisher = $(PubServer),
    @publisher_db = @publicationDB,
    @publication = @publication,
    @upload_first = N'true';
GO

-- Start the Merge Agent.

toestemmingen

Alleen leden van de sysadmin-vaste serverrol of de db_owner vaste databaserol kunnen uitvoeren sp_reinitmergepullsubscription.