sp_adddistpublisher (języka Transact-SQL)

Konfiguruje Wydawca do dystrybucji określonej bazy danych.Ta procedura składowana jest wykonywany na dystrybutora na dowolnej bazy danych.Należy zauważyć, że procedura składowana sp_adddistributor (języka Transact-SQL) i sp_adddistributiondb (języka Transact-SQL) należy uruchomić jeszcze przed rozpoczęciem korzystania z procedura składowana.

Ikona łącza do tematuKonwencje składni Transact-SQL

Składnia

sp_adddistpublisher [ @publisher= ] 'publisher' 
        , [ @distribution_db= ] 'distribution_db' 
    [ , [ @security_mode= ] security_mode ] 
    [ , [ @login= ] 'login' ] 
    [ , [ @password= ] 'password' ] 
    [ , [ @working_directory= ] 'working_directory' ] 
    [ , [ @trusted= ] 'trusted' ] 
    [ , [ @encrypted_password= ] encrypted_password ] 
    [ , [ @thirdparty_flag = ] thirdparty_flag ]
    [ , [ @publisher_type = ] 'publisher_type' ]

Argumenty

  • [ @ publisher = 'wydawcy"
    Is the Publisher name.publisher is sysname, with no default.

  • [ @ distribution_db = 'distribution_db"
    Is the name of the distribution database.distributor_db is sysname, with no default.Ten parametr jest używany przez agentów replikacja, aby połączyć Wydawca.

  • [ @ security_mode = security_mode
    Jest to tryb zabezpieczeń implementowane.This parameter is only used by replication agents to connect to the Publisher for queued updating subscriptions or with a non-SQL Server Publisher.security_mode is int, and can be one of these values.

    Wartość

    Opis

    0

    Agenci replikacji przy użyciu dystrybutora SQL Server uwierzytelniania, aby połączyć Wydawca.

    1 (domyślnie)

    Agenci replikacji na dystrybutora połączyć za pomocą uwierzytelniania systemu Windows Wydawca.

  • [ @ login = 'logowania"
    Jest logowania.This parameter is required if security_mode is 0.login is sysname, with a default of NULL.Ten parametr jest używany przez agentów replikacja, aby połączyć Wydawca.

  • [ @ hasło = 'hasło'
    Is the password.password is sysname, with a default of NULL.Ten parametr jest używany przez agentów replikacja, aby połączyć Wydawca.

    Uwaga dotycząca zabezpieczeńUwaga dotycząca zabezpieczeń

    Nie należy używać pustego hasła.Należy używać silnego hasła.

  • [ @ working_directory = 'working_directory"
    Is the name of the working directory used to store data and schema files for the publication.working_directory is nvarchar(255), and defaults to the ReplData folder for this instance of SQL Server, for example 'C:\Program Files\Microsoft SQL Server\MSSQL\MSSQ.1\ReplData'.Nazwę należy określić w formacie UNC.

  • [ @ zaufane = 'zaufanych"
    This parameter has been deprecated and is provided for backward compatibility only.trusted is nvarchar(5), and setting it to anything but false will result in an error.

  • [ @ encrypted_password = encrypted_password
    Ustawienie encrypted_password nie jest już obsługiwany.Próby zestaw to bit parametr 1 spowoduje błąd.

  • [ @ thirdparty_flag = thirdparty_flag
    Is when the Publisher is SQL Server.thirdparty_flag is bit, and can be one of the following values.

    Wartość

    Opis

    0 (domyślnie)

    SQL Server Baza danych.

    1

    Bazy danych innych niż SQL Server.

  • [ @ publisher_type=] 'publisher_type"
    Specifies the Publisher type when the Publisher is not SQL Server.publisher_type is sysname, and can be one of the following values.

    Wartość

    Opis

    MSSQLSERVER

    (wartość domyślna)

    Określa SQL Server Wydawca.

    ORACLE

    Określa standardowy Wydawca Oracle.

    BRAMA ORACLE

    Określa Wydawca bramy Oracle.

    Aby uzyskać więcej informacji o różnicach między Wydawca Oracle i Wydawca bramy Oracle, zobacz Konfigurowanie Wydawca Oracle.

Wartości kodów powrotnych

0 (sukces) lub 1 (błąd)

Uwagi

sp_adddistpublisher jest używana przez replikacja migawka, replikacja transakcyjna i scalania replikacji.

Przykład

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

-- Install the Distributor and the distribution database.
DECLARE @distributor AS sysname;
DECLARE @distributionDB AS sysname;
DECLARE @publisher AS sysname;
DECLARE @directory AS nvarchar(500);
DECLARE @publicationDB AS sysname;
-- Specify the Distributor name.
SET @distributor = $(DistPubServer);
-- Specify the distribution database.
SET @distributionDB = N'distribution';
-- Specify the Publisher name.
SET @publisher = $(DistPubServer);
-- Specify the replication working directory.
SET @directory = N'\\' + $(DistPubServer) + '\repldata';
-- Specify the publication database.
SET @publicationDB = N'AdventureWorks2008R2'; 

-- Install the server MYDISTPUB as a Distributor using the defaults,
-- including autogenerating the distributor password.
USE master
EXEC sp_adddistributor @distributor = @distributor;

-- Create a new distribution database using the defaults, including
-- using Windows Authentication.
USE master
EXEC sp_adddistributiondb @database = @distributionDB, 
    @security_mode = 1;
GO

-- Create a Publisher and enable AdventureWorks2008R2 for replication.
-- Add MYDISTPUB as a publisher with MYDISTPUB as a local distributor
-- and use Windows Authentication.
DECLARE @distributionDB AS sysname;
DECLARE @publisher AS sysname;
-- Specify the distribution database.
SET @distributionDB = N'distribution';
-- Specify the Publisher name.
SET @publisher = $(DistPubServer);

USE [distribution]
EXEC sp_adddistpublisher @publisher=@publisher, 
    @distribution_db=@distributionDB, 
    @security_mode = 1;
GO 

Uprawnienia

Tylko członkowie sysadmin stała rola serwera można wykonać sp_adddistpublisher.