sp_reinitmergepullsubscription(Transact-SQL)

다음 번 병합 에이전트 실행 시 병합 끌어오기 구독이 다시 초기화되도록 표시합니다. 이 저장 프로시저는 구독 데이터베이스의 구독자에서 실행됩니다.

항목 링크 아이콘Transact-SQL 구문 표기 규칙

구문

sp_reinitmergepullsubscription [ [ @publisher = ] 'publisher' ]
    [ , [ @publisher_db = ] 'publisher_db' ]
    [ , [ @publication = ] 'publication' ]
    [ , [ @upload_first = ] 'upload_first'

인수

  • [ @publisher = ] 'publisher'
    게시자의 이름입니다. publishersysname이며 기본값은 ALL입니다.
  • [ @publisher_db = ] 'publisher_db'
    게시자 데이터베이스의 이름입니다. publisher_dbsysname이며 기본값은 ALL입니다.
  • [ @publication= ] 'publication'
    게시 이름입니다. publicationsysname이며 기본값은 ALL입니다.
  • [ @upload_first = ] 'upload_first'
    구독을 다시 초기화하기 전에 구독자의 변경 내용을 업로드할지 여부입니다. upload_first는 **nvarchar(5)**이며 기본값은 FALSE입니다. true이면 구독이 다시 초기화되기 전에 변경 내용이 업로드되고 false이면 변경 내용이 업로드되지 않습니다.

반환 코드 값

0(성공) 또는 1(실패)

주의

sp_reinitmergepullsubscription은 병합 복제에 사용됩니다.

매개 변수가 있는 필터를 추가, 삭제 또는 변경할 경우 다시 초기화를 진행하는 동안에는 보류 중인 구독자의 변경 내용을 게시자로 업로드할 수 없습니다. 보류 중인 변경 내용을 업로드하려면 필터를 변경하기 전에 모든 구독을 동기화하십시오.

사용 권한

sysadmin 고정 서버 역할 또는 db_owner 고정 데이터베이스 역할의 멤버만이 sp_reinitmergepullsubscription을 실행할 수 있습니다.

-- 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'AdventureWorks';
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorksReplica]

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

-- 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'AdventureWorks';
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorksReplica]

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

참고 항목

참조

시스템 저장 프로시저(Transact-SQL)

관련 자료

How to: Reinitialize a Subscription (Replication Transact-SQL Programming)
구독 다시 초기화

도움말 및 정보

SQL Server 2005 지원 받기