Udostępnij za pośrednictwem


sp_adddistributiondb (Transact-SQL)

Tworzy nową baza danych dystrybucji i instaluje dystrybutor schematu.baza danych dystrybucji przechowuje procedur, schematu i metadane w replikacja.Ta procedura przechowywana jest wykonywany na dystrybutor wzorzec bazy danych w celu utworzenia baza danych dystrybucji i zainstalować niezbędne tabel i procedur przechowywanych, które są wymagane w celu umożliwienia dystrybucji replikacja.

Topic link iconKonwencje składni języka Transact-SQL

sp_adddistributiondb [ @database= ] 'database' 
    [ , [ @data_folder= ] 'data_folder' ] 
    [ , [ @data_file= ] 'data_file' ] 
    [ , [ @data_file_size= ] data_file_size ] 
    [ , [ @log_folder= ] 'log_folder' ] 
    [ , [ @log_file= ] 'log_file' ] 
    [ , [ @log_file_size= ] log_file_size ] 
    [ , [ @min_distretention= ] min_distretention ] 
    [ , [ @max_distretention= ] max_distretention ] 
    [ , [ @history_retention= ] history_retention ] 
    [ , [ @security_mode= ] security_mode ] 
    [ , [ @login= ] 'login' ] 
    [ , [ @password= ] 'password' ] 
    [ , [ @createmode= ] createmode ]
    [ , [ @from_scripting = ] from_scripting ]

Argumenty

  • [ @database=] database'
    Is the name of the distribution database to be created.database is sysname, with no default.Jeśli określona baza danych już istnieje i nie jest już oznaczona jako baza danych dystrybucji, następnie są instalowane obiektów, niezbędne do włączenia dystrybucji, a baza danych jest oznaczony jako baza danych dystrybucji.Jeśli określona baza danych jest już włączony jako baza danych dystrybucji, zwracany jest błąd.

  • [ @data_folder=] **'**data_folder'
    Is the name of the directory used to store the distribution database data file.data_folder is nvarchar(255), with a default of NULL.If NULL, the data directory for that instance of Microsoft SQL Server is used, for example, C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data.

  • [ @data_file=] 'data_file'
    Is the name of the database file.data_file is nvarchar(255), with a default of database.Jeśli wartością tą jest NULL, procedura przechowywana konstruuje nazwę pliku, przy użyciu nazwy bazy danych.

  • [ @data_file_size=] data_file_size
    Is the initial data file size in megabytes (MB).data_file_size is int, with a default of 5MB.

  • [ @log_folder=] 'log_folder'
    Is the name of the directory for the database log file.log_folder is nvarchar(255), with a default of NULL.Jeśli wartością tą jest NULL, katalog danych dla tego wystąpienie SQL Server jest używany (na przykład C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data).

  • [ @log_file=] 'log_file'
    Is the name of the log file.log_file is nvarchar(255), with a default of NULL.Jeśli wartością tą jest NULL, procedura przechowywana konstruuje nazwę pliku, przy użyciu nazwy bazy danych.

  • [ @log_file_size=] log_file_size
    Is the initial log file size in megabytes (MB).log_file_size is int, with a default of 0 MB, which means the file size is created using the smallest log file size allowed by SQL Server.

  • [ @min_distretention=] min_distretention
    Is the minimum retention period, in hours, before transactions are deleted from the distribution database.min_distretention is int, with a default of 0 hours.

  • [ @max_distretention=] max_distretention
    Is the maximum retention period, in hours, before transactions are deleted.max_distretention is int, with a default of 72 hours.Subskrypcje, które nie otrzymał replikowanych poleceń, które są starsze niż okres zachowywania maksymalną dystrybucji są oznaczone jako nieaktywne i konieczne jest ustawienie ponownie inicjowane.RAISERROR 21011 jest wydawane dla wszystkich nieaktywnych subskrypcja.Wartość 0 oznacza, że replikowane transakcje nie są przechowywane w bazie danych dystrybucji.

  • [ @history_retention=] history_retention
    Is the number of hours to retain history.history_retention is int, with a default of 48 hours.

  • [ @security_mode=] security_mode
    Is the security mode to use when connecting to the Distributor.security_mode is int, with a default of 1.0 Określa, SQL Server Uwierzytelniania; 1 określa zintegrowane uwierzytelnianie systemu Windows.

  • [ @login=] 'login'
    Jest nazwą logowania używanej przy łączeniu się z dystrybutor do utworzenia baza danych dystrybucji.This is required if security_mode is set to 0.login is sysname, with a default of NULL.

  • [ @password=] 'password'
    Hasło jest używane przy nawiązywaniu połączenia z dystrybutor.Jest to wymagane, jeśli security_mode jest zestaw do 0. password jest sysname, z domyślną wartość NULL.

  • [ @createmode=] createmode
    createmode jest int, z domyślną 1, i może mieć jedną z następujących wartości.

    Wartość

    Description

    0

    Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.

    1 (domyślnie)

    CREATE DATABASE lub Użyj istniejącej bazy danych, a następnie zastosować Instdist.SQL plik do tworzenia obiektów, replikację baza danych dystrybucji.

    2

    Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.

  • [ @from_scripting = ] from_scripting
    Identified for informational purposes only. Not supported. Future compatibility is not guaranteed.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Remarks

sp_adddistributiondb jest używany we wszystkich typach replikacja.Jednak ta procedura przechowywana jest uruchamiany tylko u dystrybutor.

Należy skonfigurować dystrybutor, wykonując sp_adddistributor przed wykonaniem sp_adddistributiondb.

Uruchamianie sp_adddistributor przed do uruchamiania sp_adddistributiondb.

Uprawnienia

Tylko członkowie sysadmin roli serwera stałe mogą być wykonać sp_adddistributiondb.