sp_adddistpublisher(Transact-SQL)

지정된 배포 데이터베이스를 사용하기 위해 게시자를 구성합니다. 이 저장 프로시저는 모든 데이터베이스의 배포자에서 실행됩니다. 이 저장 프로시저를 사용하기 전에 sp_adddistributor(Transact-SQL)sp_adddistributiondb(Transact-SQL) 저장 프로시저를 실행해야 합니다.

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

구문

sp_adddistpublisher [ @publisher= ] 'publisher' 
        , [ @distribution_db= ] 'distribution_db' 
    [ , [ @security_mode= ] security_mode ] 
    [ , [ @login= ] 'login' ] 
    [ , [ @password= ] 'password' ] 
    [ , [ @working_directory= ] 'working_directory' ] 
    [ , [ @trusted= ] 'trusted' ] 
    [ , [ @encrypted_password= ] encrypted_password ] 
    [ , [ @thirdparty_flag = ] thirdparty_flag ]
    [ , [ @publisher_type = ] 'publisher_type' ]

인수

  • [ @publisher=] 'publisher'
    게시자 이름입니다. publishersysname이며 기본값은 없습니다.
  • [ @distribution_db=] 'distribution_db'
    배포 데이터베이스의 이름입니다. distributor_dbsysname이며 기본값은 없습니다. 이 매개 변수는 복제 에이전트가 게시자에 연결할 때 사용합니다.
  • [ @security_mode=] security_mode
    구현된 보안 모드입니다. 이 매개 변수는 복제 에이전트가 지연 구독 업데이트에 대한 게시자 또는 비-SQL Server(Non-SQL Server) 게시자에 연결하는 경우에만 사용됩니다. security_modeint이며 다음 값 중 하나일 수 있습니다.

    설명

    0

    배포자의 복제 에이전트는 SQL Server 인증을 사용하여 게시자에 연결합니다.

    1(기본값)

    배포자의 복제 에이전트는 Windows 인증을 사용하여 게시자에 연결합니다.

  • [ @login=] 'login'
    로그인입니다. security_mode0인 경우 이 매개 변수가 필요합니다. loginsysname이며 기본값은 NULL입니다. 이 매개 변수는 복제 에이전트가 게시자에 연결할 때 사용합니다.
  • [ @password=] 'password']
    암호입니다. passwordsysname이며 기본값은 NULL입니다. 이 매개 변수는 복제 에이전트가 게시자에 연결할 때 사용합니다.

    ms173807.security(ko-kr,SQL.90).gif보안 정보:
    빈 암호를 사용하지 마십시오. 강력한 암호를 사용하십시오.
  • [ @working_directory=] 'working_directory'
    게시용 데이터 및 스키마 파일을 저장하기 위한 작업 디렉터리의 이름입니다. working_directory는 **nvarchar(255)**이며 기본값은 SQL Server 인스턴스에 대한 ReplData 폴더입니다(예: 'C:\Program Files\Microsoft SQL Server\MSSQL\MSSQ.1\ReplData'). 이름은 반드시 UNC 형식으로 지정되어야 합니다.
  • [ @trusted=] 'trusted'
    이 매개 변수는 더 이상 사용되지 않으며 이전 버전과의 호환성을 위해서만 제공됩니다. trusted는 **nvarchar(5)**이며 false 이외의 값으로 설정할 경우 오류가 발생합니다.
  • [ @encrypted_password=] encrypted_password
    encrypted_password 설정은 더 이상 지원되지 않습니다. 이 bit 매개 변수를 1로 설정하면 오류가 발생합니다.
  • [ @thirdparty_flag =] thirdparty_flag
    게시자가 SQL Server인지 여부입니다. thirdparty_flagbit이며 다음 값 중 하나일 수 있습니다.

    설명

    0(기본값)

    SQL Server 데이터베이스입니다.

    1

    SQL Server가 아닌 데이터베이스입니다.

  • [ @publisher_type= ] 'publisher_type'
    게시자가 SQL Server가 아닌 경우 게시자 유형을 지정합니다. publisher_type은 sysname이며 다음 값 중 하나일 수 있습니다.

    설명

    MSSQLSERVER?

    (기본값)

    SQL Server 게시자를 지정합니다.

    ORACLE

    표준 Oracle 게시자를 지정합니다.

    ORACLE GATEWAY

    Oracle Gateway 게시자를 지정합니다.

    Oracle 게시자와 Oracle Gateway 게시자의 차이점에 대한 자세한 내용은 Oracle 게시자 구성을 참조하십시오.

반환 코드 값

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

주의

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

사용 권한

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

-- 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_changedistpublisher(Transact-SQL)
sp_dropdistpublisher(Transact-SQL)
sp_helpdistpublisher(Transact-SQL)
시스템 저장 프로시저(Transact-SQL)

관련 자료

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

도움말 및 정보

SQL Server 2005 지원 받기