sp_addmergepullsubscription(Transact-SQL)
업데이트: 2007년 9월 15일
병합 게시에 끌어오기 구독을 추가합니다. 이 저장 프로시저는 구독 데이터베이스의 구독자에서 실행됩니다.
구문
sp_addmergepullsubscription [ @publication= ] 'publication'
[ , [ @publisher= ] 'publisher' ]
[ , [ @publisher_db = ] 'publisher_db' ]
[ , [ @subscriber_type= ] 'subscriber_type' ]
[ , [ @subscription_priority= ] subscription_priority ]
[ , [ @sync_type= ] 'sync_type' ]
[ , [ @description= ] 'description' ]
인수
- [ @publication = ] 'publication'
게시 이름입니다. publication은 sysname이며 기본값은 없습니다.
- [ @publisher = ] 'publisher'
게시자 이름입니다. Publisher는 sysname이며 기본값은 로컬 서버 이름입니다. 게시자는 유효한 서버여야 합니다.
- [ @publisher_db=] 'publisher_db'
게시자 데이터베이스 이름입니다. publisher_db는 sysname이며 기본값은 NULL입니다.
- [ @subscriber_type=] 'subscriber_type'
구독자 유형입니다. subscriber_type은 **nvarchar(15)**이며 global, local 또는 anonymous가 될 수 있습니다. SQL Server 2005에서 로컬 구독은 클라이언트 구독이라고 하며 전역 구독은 서버 구독이라고 합니다. 자세한 내용은 병합 복제의 충돌 감지 및 해결 방법의 "구독 유형" 섹션을 참조하십시오. anonymous 값이 필요한 경우는 게시자에 구독을 등록하지 않고 구독을 만들려는 경우이며 웹 동기화와 같이 구독 구성 중에 게시자에 대한 SQL Server 연결을 설정할 수 없는 경우 이 작업을 수행해야 합니다.
- [ @subscription_priority=] subscription_priority
구독 우선 순위입니다. subscription_priority는 real이며 기본값은 NULL입니다. 로컬 및 익명 구독의 경우에는 우선 순위가 0.0입니다. 우선 순위는 기본 해결 프로그램이 충돌을 감지했을 때 적용되는 내용을 선택하는 데 사용합니다. 전역 구독자인 경우 구독 우선 순위는 100 미만이어야 합니다. 100은 게시자의 우선 순위입니다.
[ @sync_type=] 'sync_type'
구독 동기화 유형입니다. sync_type은 **nvarchar(15)**이며 기본값은 automatic입니다. automatic 또는 none이 될 수 있습니다. automatic인 경우 게시된 테이블의 스키마 및 초기 데이터가 구독자에게 먼저 전송됩니다. none인 경우 구독자에 게시된 테이블의 스키마 및 초기 데이터를 이미 있다고 가정합니다. 시스템 테이블 및 데이터는 항상 전송됩니다.[!참고] none 값은 지정하지 않는 것이 좋습니다. 자세한 내용은 스냅숏 없이 병합 구독 초기화를 참조하십시오.
- [ @description =] 'description'
이 끌어오기 구독에 대한 간단한 설명입니다. description은 **nvarchar(255)**이며 기본값은 NULL입니다. 이 값은 복제 모니터에서 이름 열에 표시되며 모니터링되는 게시에 대한 구독을 정렬하는 데 사용할 수 있습니다.
반환 코드 값
0(성공) 또는 1(실패)
주의
sp_addmergepullsubscription은 병합 복제에 사용됩니다.
SQL Server 에이전트를 사용하여 구독을 동기화하는 경우 sp_addmergepullsubscription_agent 저장 프로시저를 구독자에서 실행하여 게시와 동기화하기 위한 작업 및 에이전트를 만들어야 합니다.
사용 권한
sysadmin 고정 서버 역할의 멤버 또는 db_owner 고정 데이터베이스 역할의 멤버만 sp_addmergepullsubscription_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".
-- Execute this batch at the Subscriber.
DECLARE @publication AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publicationDB AS sysname;
DECLARE @hostname AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @publisher = $(PubServer);
SET @publicationDB = N'AdventureWorks';
SET @hostname = N'adventure-works\david8';
-- At the subscription database, create a pull subscription
-- to a merge publication.
USE [AdventureWorksReplica]
EXEC sp_addmergepullsubscription
@publisher = @publisher,
@publication = @publication,
@publisher_db = @publicationDB;
-- Add an agent job to synchronize the pull subscription.
EXEC sp_addmergepullsubscription_agent
@publisher = @publisher,
@publisher_db = @publicationDB,
@publication = @publication,
@distributor = @publisher,
@job_login = $(Login),
@job_password = $(Password),
@hostname = @hostname;
GO
-- 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".
-- Publication must support anonymous Subscribers.
-- Execute this batch at the Subscriber.
DECLARE @publication AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publicationDB AS sysname;
DECLARE @websyncurl AS sysname;
DECLARE @security_mode AS int;
DECLARE @login AS sysname;
DECLARE @password AS nvarchar(512);
SET @publication = N'AdvWorksSalesOrdersMergeWebSync';
SET @publisher = $(PubServer);
SET @publicationDB = N'AdventureWorks';
SET @websyncurl = 'https://' + $(WebServer) + '/WebSync';
SET @security_mode = 0; -- Basic Authentication for IIS
SET @login = $(Login);
SET @password = $(Password);
-- At the subscription database, create a pull subscription
-- to a merge publication.
USE [AdventureWorksReplica]
EXEC sp_addmergepullsubscription
@publisher = @publisher,
@publication = @publication,
@publisher_db = @publicationDB,
@subscriber_type = N'anonymous';
-- Add an agent job to synchronize the pull subscription.
EXEC sp_addmergepullsubscription_agent
@publisher = @publisher,
@publisher_db = @publicationDB,
@publication = @publication,
@distributor = @publisher,
@job_login = @login,
@job_password = @password,
@use_web_sync = 1,
@internet_security_mode = @security_mode,
@internet_url = @websyncurl,
@internet_login = @login,
@internet_password = @password;
GO
참고 항목
참조
sp_addmergepullsubscription_agent(Transact-SQL)
sp_changemergepullsubscription(Transact-SQL)
sp_dropmergepullsubscription(Transact-SQL)
sp_helpmergepullsubscription(Transact-SQL)
sp_helpsubscription_properties(Transact-SQL)
관련 자료
방법: 끌어오기 구독 만들기(Replication Transact-SQL Programming)
게시 구독
도움말 및 정보
변경 내역
릴리스 | 내역 |
---|---|
2007년 9월 15일 |
|
2006년 12월 12일 |
|