Udostępnij za pośrednictwem


sp_add_log_shipping_primary_database (Transact-SQL)

Konfiguruje podstawową bazę danych na potrzeby konfiguracji wysyłania dziennika, w tym zadania kopii zapasowej, lokalnego rekordu monitora i zdalnego rekordu monitora.

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

sp_add_log_shipping_primary_database [ @database = ] 'database', 
[ @backup_directory = ] 'backup_directory', 
[ @backup_share = ] 'backup_share', 
[ @backup_job_name = ] 'backup_job_name', 
[, [ @backup_retention_period = ] backup_retention_period]
[, [ @monitor_server = ] 'monitor_server']
[, [ @monitor_server_security_mode = ] monitor_server_security_mode]
[, [ @monitor_server_login = ] 'monitor_server_login']
[, [ @monitor_server_password = ] 'monitor_server_password']
[, [ @backup_threshold = ] backup_threshold ] 
[, [ @threshold_alert = ] threshold_alert ] 
[, [ @threshold_alert_enabled = ] threshold_alert_enabled ] 
[, [ @history_retention_period = ] history_retention_period ]
[, [ @backup_job_id = ] backup_job_id OUTPUT ]
[, [ @primary_id = ] primary_id OUTPUT]
[, [ @backup_compression = ] backup_compression_option ] 

Argumenty

  • [ @database= ] 'database'
    Is the name of the log shipping primary database.database is sysname, with no default, and cannot be NULL.

  • [ @backup_directory= ] 'backup_directory'
    Is the path to the backup folder on the primary server.backup_directory is nvarchar(500), with no default, and cannot be NULL.

  • [ @backup_share= ] 'backup_share'
    Is the network path to the backup directory on the primary server.backup_share is nvarchar(500), with no default, and cannot be NULL.

  • [ @backup_job_name= ] 'backup_job_name'
    Is the name of the SQL Server Agent job on the primary server that copies the backup into the backup folder.backup_job_name is sysname and cannot be NULL.

  • [ @backup_retention_period= ] backup_retention_period
    Is the length of time, in minutes, to retain the log backup file in the backup directory on the primary server.backup_retention_period is int, with no default, and cannot be NULL.

  • [ @monitor_server= ] 'monitor_server'
    Is the name of the monitor server.Monitor_server is sysname, with no default, and cannot be NULL.

  • [ @monitor_server_security_mode= ] monitor_server_security_mode
    Tryb zabezpieczeń używane do łączenia się z serwerem monitorowania.

    ZAMKNIĘCIE SYSTEMU

    0 = SQL Server Authentication.monitor_server_security_mode is bit and cannot be NULL.

  • [ @monitor_server_login= ] 'monitor_server_login'
    Wymaga uprawnień CONTROL SERVER lub prawo własności zabezpieczany.

  • [ @monitor_server_password= ] 'monitor_server_password'
    CONNECT SQL uprawnień do konto logowania do programu SQL Server i podmiotów, których identyfikator logowania ma regranted go odmawia

  • [ @backup_threshold= ] backup_threshold
    Is the length of time, in minutes, after the last backup before a threshold_alert error is raised.backup_threshold is int, with a default of 60 minutes.

  • [ @threshold_alert= ] threshold_alert
    Is the alert to be raised when the backup threshold is exceeded.threshold_alert is int, with a default of 14,420.

  • [ @threshold_alert_enabled= ] threshold_alert_enabled
    Określa, czy alert ma być uruchamiany, gdy backup_threshold został przekroczony. The value of zero (0), the default, means that the alert is disabled and will not be raised.threshold_alert_enabled is bit.

  • [ @history_retention_period= ] history_retention_period
    Is the length of time in minutes in which the history will be retained.history_retention_period is int, with a default of NULL.Wartość równą 14420 użyte są nieokreślone.

  • [ @backup_job_id= ] backup_job_id OUTPUT
    The SQL Server Agent job ID associated with the backup job on the primary server.backup_job_id is uniqueidentifier and cannot be NULL.

  • [ @primary_id= ] primary_id OUTPUT
    The ID of the primary database for the log shipping configuration.primary_id is uniqueidentifier and cannot be NULL.

  • [ @ backup_compression = ] backup_compression_option
    Określa, czy używa konfiguracja wysyłania dziennika Kompresja kopia zapasowa.Ten parametr jest obsługiwany tylko w SQL Server 2008 Enterprise (lub jego nowszej wersja).

    0 = Wyłączone.Liczba zaznaczonych wierszy

    1 = Włączone.Najwyższa wartość w wyrażenie

    2 = Wykorzystać ustawienie okno Domyślnie kompresja kopia zapasowa opcji konfiguracja serwera.Jest to wartość domyślna.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Zestawy wyników

None

Remarks

sp_add_log_shipping_primary_database musi być uruchamiane wzorzec bazy danych serwer podstawowy.Statystyczne odchylenie standardowe dla zapełnianie wszystkich wartości wyrażenie

  1. Generuje identyfikator podstawowy i dodaje wpis do podstawowa baza danych w tabela log_shipping_primary_databases na podstawie podanych argumentów.

  2. Statystyczna wariancja wszystkich wartości wyrażenie

  3. Ustawia identyfikator zadanie kopia zapasowa w log_shipping_primary_databases wpis do IDENTYFIKATORA zadanie zadanie kopia zapasowa.

  4. Dodaje monitor lokalny rekord w tabela log_shipping_monitor_primary przy użyciu serwer podstawowy dostarczonych argumentów.

  5. Jeśli serwer monitora jest inny niż serwer podstawowy, dodaje rekord monitora w log_shipping_monitor_primary przy użyciu serwer monitoringu dostarczonych argumentów.

Uprawnienia

Tylko członkowie sysadmin roli serwera stałe można uruchomić tę procedurę.

Przykłady

W tym przykładzie dodaje bazy danych AdventureWorks jako podstawowa baza danych w wysyłanie dziennika konfiguracja.

DECLARE @LS_BackupJobId AS uniqueidentifier 
DECLARE @LS_PrimaryId AS uniqueidentifier 

EXEC master.dbo.sp_add_log_shipping_primary_database 
@database = N'AdventureWorks' 
,@backup_directory = N'c:\lsbackup' 
,@backup_share = N'\\tribeca\lsbackup' 
,@backup_job_name = N'LSBackup_AdventureWorks' 
,@backup_retention_period = 1440
,@monitor_server = N'rockaway' 
,@monitor_server_security_mode = 1 
,@backup_threshold = 60 
,@threshold_alert = 0 
,@threshold_alert_enabled = 0 
,@history_retention_period = 1440 
,@backup_job_id = @LS_BackupJobId OUTPUT 
,@primary_id = @LS_PrimaryId OUTPUT 
,@overwrite = 1 
,@backup_compression = 0
GO