sp_dropdistributor(Transact-SQL)

적용 대상:SQL ServerAzure SQL Managed Instance

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

Transact-SQL 구문 표기 규칙

구문

sp_dropdistributor
    [ [ @no_checks = ] no_checks ]
    [ , [ @ignore_distributor = ] ignore_distributor ]
[ ; ]

인수

[ @no_checks = ] no_검사

배포자를 삭제하기 전에 종속 개체에 대해 검사 여부를 나타냅니다. @no_검사 비트이며 기본값은 .입니다0.

  • sp_dropdistributor 이면 0배포자 외에 모든 게시 및 배포 개체가 삭제되었는지 확인하는 검사.

  • sp_dropdistributor 이면 1배포자를 제거하기 전에 모든 게시 및 배포 개체를 삭제합니다.

[ @ignore_distributor = ] ignore_distributor

이 저장 프로시저가 배포자에 연결되지 않고 실행되는지 여부를 표시합니다. @ignore_distributor 비트이며 기본값은 .입니다0.

  • sp_dropdistributor 이면 0배포자에 연결하고 모든 복제본(replica)tion 개체를 제거합니다. 배포자에 연결할 수 없는 경우 sp_dropdistributor 저장 프로시저가 실패합니다.

  • 배포자에 연결되지 않고 복제본(replica) 개체가 제거되지 않는 경우 1 이 옵션은 배포자가 제거되거나 영구적으로 오프라인 상태인 경우에 사용됩니다. 배포자에서 이 게시자의 개체는 나중에 배포자가 다시 설치될 때까지 제거되지 않습니다.

반환 코드 값

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

설명

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

서버에 sp_dropdistributor 다른 게시자 또는 배포 개체가 있는 경우 @no_검사 설정1되지 않으면 실패합니다.

이 저장 프로시저는 배포 데이터베이스를 삭제한 후 실행해야 sp_dropdistributiondb합니다.

예제

-- 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_dropdistributor수 있습니다.