sp_dropdistpublisher (Transact-SQL)

卸除散發發行者。這個預存程序執行於任何資料庫中的散發者端。

主題連結圖示Transact-SQL 語法慣例

語法

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

引數

  • [ @publisher= ] 'publisher'
    這是要卸除的發行者。publishersysname,沒有預設值。
  • [ @no_checks= ] no_checks
    指定 sp_dropdistpublisher 是否要檢查發行者已將作為散發者的伺服器解除安裝。no_checksbit,預設值是 0

    如果是 0,複寫會確認遠端發行者已將作為散發者的本機伺服器解除安裝。如果發行者在本機,複寫會確認本機伺服器中沒有其餘發行集或散發物件。

    如果是 1,便會卸除所有與散發發行者相關聯的複寫物件,即使無法連上遠端發行者,也是如此。執行這個動作之後,遠端發行者必須使用 @ignore_distributor = 1sp_dropdistributor 來將複寫解除安裝。

  • [ @ignore_distributor= ] ignore_distributor
    指定當移除發行者時,是否將散發物件保留在散發者端。ignore_distributorbit,它可以是下列值之一:

    1 = 屬於 publisher 的散發物件保留在散發者端。

    0 = 在散發者端清除 publisher 的散發物件。

傳回碼值

0 (成功) 或 1 (失敗)

備註

sp_dropdistpublisher 用於所有類型的複寫中。

當卸除 Oracle 發行者時,如果無法卸除發行者,sp_dropdistpublisher 會傳回錯誤,並移除發行者的散發者物件。

權限

只有系統管理員 (sysadmin) 固定伺服器角色的成員,才能夠執行 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'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

請參閱

參考

sp_adddistpublisher (Transact-SQL)
sp_changedistpublisher (Transact-SQL)
sp_helpdistpublisher (Transact-SQL)
複寫預存程序 (Transact-SQL)

其他資源

How to: Disable Publishing and Distribution (Replication Transact-SQL Programming)

說明及資訊

取得 SQL Server 2005 協助