sp_dropdistributiondb(Transact-SQL)
SQL Server 2005
배포 데이터베이스를 삭제합니다. 다른 데이터베이스에 해당 물리적 파일이 사용되지 않는 경우에 한해 데이터베이스에 사용되는 물리적 파일을 삭제합니다. 이 저장 프로시저는 모든 데이터베이스의 배포자에서 실행됩니다.
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'AdventureWorks'; -- Disable the publication database. USE [AdventureWorks] 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