Aracılığıyla paylaş


sp_add_log_shipping_primary_database (Transact-SQL)

Birincil veritabanı yedek işi, yerel bir monitör kayıt ve uzak monitör kaydı içeren bir günlük aktarma yapılandırması için ayarlar.

Topic link iconTransact-SQL sözdizimi kuralları

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 ] 

Bağımsız değişkenler

  • [ @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
    izleme sunucusu bağlanmada kullanılan güvenlik modunu.

    1 Windows kimlik doğrulaması =.

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

  • [ @monitor_server_login= ] 'monitor_server_login'
    izleme sunucusu erişmek için kullanılan hesabın kullanıcı adı olarak belirtilir.

  • [ @monitor_server_password= ] 'monitor_server_password'
    izleme sunucusu erişmek için kullanılan hesabın paroladır.

  • [ @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
    Uyarı olup olmayacağını belirtir ne zaman oluşturulur backup_threshold aştı. 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.Belirtilmezse, 14420 değeri kullanılır.

  • [ @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
    Belirtir olup olmadığını bir günlük aktarma yapılandırması kullanır yedek sıkıştırma.Bu parametre yalnızca destekleniyor SQL Server 2008 Enterprise (veya sonraki bir sürüm).

    0 = Devre dışı.Hiçbir zaman sıkıştırma günlük yedeklemeler.

    1 = Etkin.Her zaman günlük yedeklemeler sıkıştırın.

    2 = Ayarını kullanmak yedek sıkıştırma varsayılan sunucu yapılandırma seçeneği.Bu varsayılan değerdir.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (hata)

Sonuç Kümeleri

None

Remarks

sp_add_log_shipping_primary_database çalıştırılmalıdır.Yönetici veritabanında birincil sunucu.Bu saklı yordam aşağıdaki işlevleri gerçekleştirir:

  1. Birincil bir KIMLIK üretir ve birincil veritabanının bir girdi ekler tablo log_shipping_primary_databases sağlanan bağımsız değişken kullanma.

  2. Devre dışı bırakılan bir birincil veritabanı için bir yedek işi oluşturur.

  3. yedek işi KIMLIĞINI ayarlar log_shipping_primary_databases girdi yedek işi iş KIMLIĞI.

  4. Yerel monitör kayıt ekler tablo log_shipping_monitor_primary birincil sunucu kullanarak bağımsız değişkenleri sağladı.

  5. Monitör sunucunun birincil sunucudan farklı ise, monitör kayıt ekler. log_shipping_monitor_primary sunucu monitör kullanarak bağımsız değişkenleri sağladı.

İzinler

Yalnızca üyeleri sysadmin sabit sunucu rolü, bu yordamı çalıştırabilirsiniz.

Örnekler

Bu örnek, veritabanına ekler. AdventureWorks bir Günlük Sevkiyat yapılandırmasında birincil veritabanı olarak.

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