sp_adddistributor(Transact-SQL)

항목이 없는 경우 sys.sysservers 테이블에 항목을 만들고 해당 서버 항목을 배포자로 표시한 다음 속성 정보를 저장합니다. 이 저장 프로시저는 서버를 배포자로 등록하고 표시하기 위해 마스터 데이터베이스의 배포자에서 실행됩니다. 원격 배포자의 경우도 마찬가지로, 원격 배포자를 등록하기 위해 마스터 데이터베이스의 게시자에서 실행됩니다.

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

구문

sp_adddistributor [ @distributor= ] 'distributor' 
    [ , [ @heartbeat_interval= ] heartbeat_interval ] 
    [ , [ @password= ] 'password' ] 
    [ , [ @from_scripting= ] from_scripting ]

인수

  • [ @distributor= ] 'distributor'
    배포 서버 이름입니다. distributorsysname이며 기본값은 없습니다. 이 매개 변수는 원격 배포자를 설정할 때에만 사용합니다. 이 인수는 배포자 속성에 관한 항목을 msdb..MSdistributor 테이블에 추가합니다.
  • [ @heartbeat_interval=] heartbeat_interval
    진행 메시지를 기록하지 않고 에이전트를 계속할 수 있는 최대 시간(분)입니다. heartbeat_intervalint이며 기본값은 10분입니다. 실행 중인 복제 에이전트의 상태를 확인하기 위해 이 간격으로 실행되는 SQL Server 에이전트 작업이 생성됩니다.
  • [ @password=] 'password']
    distributor_admin 로그인의 암호입니다. passwordsysname이며 기본값은 NULL입니다. NULL 또는 빈 문자열인 경우 암호는 임의의 값으로 다시 설정됩니다. 암호는 첫 번째 원격 배포자가 추가될 때 구성되어야 합니다. distributor_admin 로그인 및 password는 로컬 연결을 포함하여 distributor RPC 연결에 사용되는 연결된 서버 항목용으로 저장됩니다. distributor가 로컬인 경우 distributor_admin의 암호는 새 값으로 설정됩니다. 원격 배포자가 있는 게시자의 경우 게시자와 배포자 양쪽에서 sp_adddistributor를 실행할 때 동일한 password 값을 지정해야 합니다. sp_changedistributor_password는 배포자 암호를 변경하는 데 사용할 수 있습니다.

    ms176028.security(ko-kr,SQL.90).gif보안 정보:
    가능한 경우 런타임 시 사용자에게 보안 자격 증명을 입력하라는 메시지가 표시됩니다. 스크립트 파일에 자격 증명을 저장해야 하는 경우에는 무단으로 액세스하지 못하도록 파일에 보안을 설정해야 합니다.
  • [ @from_scripting= ] from_scripting
    내부적으로만 사용할 수 있습니다.

반환 코드 값

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

주의

sp_adddistributor는 스냅숏 복제, 트랜잭션 복제 및 병합 복제에 사용됩니다.

사용 권한

sysadmin 고정 서버 역할의 멤버만 sp_adddistributor를 실행할 수 있습니다.

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

-- Install the Distributor and the distribution database.
DECLARE @distributor AS sysname;
DECLARE @distributionDB AS sysname;
DECLARE @publisher AS sysname;
DECLARE @directory AS nvarchar(500);
DECLARE @publicationDB AS sysname;
-- Specify the Distributor name.
SET @distributor = $(DistPubServer);
-- Specify the distribution database.
SET @distributionDB = N'distribution';
-- Specify the Publisher name.
SET @publisher = $(DistPubServer);
-- Specify the replication working directory.
SET @directory = N'\\' + $(DistPubServer) + '\repldata';
-- Specify the publication database.
SET @publicationDB = N'AdventureWorks'; 

-- Install the server MYDISTPUB as a Distributor using the defaults,
-- including autogenerating the distributor password.
USE master
EXEC sp_adddistributor @distributor = @distributor;

-- Create a new distribution database using the defaults, including
-- using Windows Authentication.
USE master
EXEC sp_adddistributiondb @database = @distributionDB, 
    @security_mode = 1;
GO

-- Create a Publisher and enable AdventureWorks for replication.
-- Add MYDISTPUB as a publisher with MYDISTPUB as a local distributor
-- and use Windows Authentication.
DECLARE @distributionDB AS sysname;
DECLARE @publisher AS sysname;
-- Specify the distribution database.
SET @distributionDB = N'distribution';
-- Specify the Publisher name.
SET @publisher = $(DistPubServer);

USE [distribution]
EXEC sp_adddistpublisher @publisher=@publisher, 
    @distribution_db=@distributionDB, 
    @security_mode = 1;
GO 

참고 항목

참조

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

관련 자료

How to: Configure Publishing and Distribution (Replication Transact-SQL Programming)
배포 구성

도움말 및 정보

SQL Server 2005 지원 받기