sys.sp_dropdistpublisher (Transact-SQL)

Dotyczy:SQL ServerAzure SQL Managed Instance

Zrzuca dystrybucję Publisher. Ta procedura składowana jest wykonywana w dystrybutorze w dowolnej bazie danych.

Transact-SQL konwencje składni

Syntax

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

Arguments

[ @publisher = ] N'publisher'

The Publisher do porzucenia. @publisher jest nazwą systemu bez wartości domyślnej.

Note

Użycie niestandardowego portu dla wydawcy SQL Server zostało wprowadzone w SQL Server 2019 (15.x). Jeśli wydawca SQL Server jest skonfigurowany z niestandardowym portem, to przy umieszczaniu takiego wydawcy na dystrybutorze podaj nazwę serwera wydawcy zamiast .<Hostname>,<PortNumber>

[ @no_checks = ] no_checks

Określa, czy sp_dropdistpublisher sprawdza, czy Publisher odinstalował serwer jako Dystrybutor. @no_checks jest bit, z domyślnym .0

  • Jeśli 0, replikacja potwierdza, że zdalny Publisher odinstalował lokalny serwer jako Dystrybutor. Jeśli Publisher jest lokalny, replikacja potwierdza, że na lokalnym serwerze nie ma żadnych obiektów publikacji ani dystrybucji.

  • Jeśli 1, wszystkie obiekty replikacji powiązane z dystrybucją Publisher są usuwane, nawet jeśli zdalny Publisher nie jest dostępny. Po tym zdalny Publisher musi odinstalować replikację za pomocą sp_dropdistributor z .@ignore_distributor = 1

[ @ignore_distributor = ] ignore_distributor

Określa, czy obiekty dystrybucji pozostają u dystrybutora po usunięciu Publisher. @ignore_distributor jest bitem i może być jedną z tych wartości:

  • 1 = obiekty dystrybucji należące do @publisher pozostają u dystrybutora.
  • 0 = obiekty dystrybucji dla @publisher są czyszczone w Dystrybutorze.

Zwracanie wartości kodu

0 (powodzenie) lub 1 (niepowodzenie).

Remarks

sp_dropdistpublisher jest używana we wszystkich typach replikacji.

Podczas upuszczenia Oracle Publisher, jeśli nie da się usunąć Publisher, sp_dropdistpublisher zwraca błąd i obiekty Distributora dla Publisher są usuwane.

Examples

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

uprawnienia

Tylko członkowie stałej roli serwera sysadmin mogą wykonywać polecenie sp_dropdistpublisher.