sp_dropdistpublisher(Transact-SQL)

적용 대상:SQL ServerAzure SQL Managed Instance

배포 게시자를 삭제합니다. 이 저장 프로시저는 모든 데이터베이스의 배포자에서 실행됩니다.

Transact-SQL 구문 표기 규칙

구문

sp_dropdistpublisher
    [ @publisher = ] N'publisher'
    [ , [ @no_checks = ] no_checks ]
    [ , [ @ignore_distributor = ] ignore_distributor ]
[ ; ]

인수

[ @publisher = ] N'publisher'

삭제할 게시자입니다. @publisher 기본값이 없는 sysname입니다.

참고 항목

SQL Server 게시자에 대한 사용자 지정 포트 사용은 SQL Server 2019(15.x)에서 도입되었습니다. SQL Server 게시자가 사용자 지정 포트로 구성된 경우 해당 게시자를 배포자에 삭제할 때 대신 게시자 서버 이름을 <Hostname>,<PortNumber>제공합니다.

[ @no_checks = ] no_검사

게시자가 서버를 배포자로 제거한 검사 여부를 sp_dropdistpublisher 지정합니다. @no_검사 비트이며 기본값은 .입니다0.

  • 경우 0복제본(replica) 원격 게시자가 로컬 서버를 배포자로 제거했는지 확인합니다. 게시자가 로컬인 경우 복제본(replica)tion은 로컬 서버에 게시 또는 배포 개체가 다시 기본 없는지 확인합니다.

  • 이 경우 1원격 게시자에 연결할 수 없는 경우에도 배포 게시자에 연결된 모든 복제본(replica)tion 개체가 삭제됩니다. 이 작업을 수행한 후 원격 게시자는 sp_dropdistributor 사용하여 @ignore_distributor = 1복제본(replica) 제거해야 합니다.

[ @ignore_distributor = ] ignore_distributor

게시자가 제거될 때 배포자에 배포 개체를 남겨둘지 여부를 지정합니다. @ignore_distributor 비트이며 다음 값 중 하나일 수 있습니다.

  • 1= 배포자에서 @publisher re기본에 속하는 배포 개체입니다.
  • 0= @publisher 대한 배포 개체는 배포자에서 클린.

반환 코드 값

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

설명

sp_dropdistpublisher는 모든 유형의 복제본(replica)에서 사용됩니다.

Oracle 게시자를 삭제할 때 게시 sp_dropdistpublisher 자를 삭제할 수 없는 경우 오류가 반환되고 게시자의 배포자 개체가 제거됩니다.

예제

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

-- Disable publishing and distribution.
DECLARE @distributionDB AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publicationDB as sysname;
SET @distributionDB = N'distribution';
SET @publisher = $(DistPubServer);
SET @publicationDB = N'AdventureWorks2022';

-- Disable the publication database.
USE [AdventureWorks2022]
EXEC sp_removedbreplication @publicationDB;

-- Remove the registration of the local Publisher at the Distributor.
USE master
EXEC sp_dropdistpublisher @publisher;

-- Delete the distribution database.
EXEC sp_dropdistributiondb @distributionDB;

-- Remove the local server as a Distributor.
EXEC sp_dropdistributor;
GO

사용 권한

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