sp_dropdistributiondb(Transact-SQL)

배포 데이터베이스를 삭제합니다. 다른 데이터베이스에 해당 물리적 파일이 사용되지 않는 경우에 한해 데이터베이스에 사용되는 물리적 파일을 삭제합니다. 이 저장 프로시저는 모든 데이터베이스의 배포자에서 실행됩니다.

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

구문

sp_dropdistributiondb [ @database= ] 'database'

인수

  • [ @database=] 'database'
    삭제할 데이터베이스입니다. database는 sysname이며 기본값은 없습니다.

반환 코드 값

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

주의

sp_dropdistributiondb는 모든 유형의 복제에 사용합니다.

이 저장 프로시저는 sp_dropdistributor를 실행하여 배포자를 삭제하기 전에 실행해야 합니다.

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'AdventureWorks2008R2';

-- Disable the publication database.
USE [AdventureWorks2008R2]
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_dropdistributiondb를 실행할 수 있습니다.