Aracılığıyla paylaş


sp_add_log_shipping_secondary_database (Transact-SQL)

Bir günlük aktarma ikincil veritabanlarını ayarlar.

Topic link iconTransact-SQL sözdizimi kuralları

sp_add_log_shipping_secondary_database
[ @secondary_database = ] 'secondary_database',
[ @primary_server = ] 'primary_server', 
[ @primary_database = ] 'primary_database',
[, [ @restore_delay = ] 'restore_delay']
[, [ @restore_all = ] 'restore_all']
[, [ @restore_mode = ] 'restore_mode']
[, [ @disconnect_users = ] 'disconnect_users']
[, [ @block_size = ] 'block_size']
[, [ @buffer_count = ] 'buffer_count']
[, [ @max_transfer_size = ] 'max_transfer_size']
[, [ @restore_threshold = ] 'restore_threshold'] 
[, [ @threshold_alert = ] 'threshold_alert'] 
[, [ @threshold_alert_enabled = ] 'threshold_alert_enabled'] 
[, [ @history_retention_period = ] 'history_retention_period']

Bağımsız değişkenler

  • [ @ secondary_database = ] 'secondary_database'
    Is the name of the secondary database.secondary_database is sysname, with no default.

  • [ @ primary_server = ] 'primary_server'
    The name of the primary instance of the Microsoft SQL Server Database Engine in the log shipping configuration.primary_server is sysname and cannot be NULL.

  • [ @ primary_database = ] 'primary_database'
    Is the name of the database on the primary server.primary_database is sysname, with no default.

  • [ @ restore_delay = ] 'restore_delay'
    The amount of time, in minutes, that the secondary server waits before restoring a given backup file.restore_delay is int and cannot be NULL.Varsayılan değer 0’dır.

  • [ @ restore_all = ] 'restore_all'
    1, İkincil sunucu olarak geri yükleme işi çalıştığında, tüm kullanılabilir iş günlüğü yedeklerini geri yükler.Otherwise, it stops after one file is restored.restore_all is bit and cannot be NULL.

  • [ @ restore_mode = ] 'restore_mode'
    Geri yükleme modu ikincil veritabanı.

    0 NORECOVERY ile geri yükleme günlük =

    1 STANDBY. geri yükleme günlük =

    restore olan bit NULL olamaz.

  • [ @ disconnect_users = ] 'disconnect_users'
    1 Olarak ayarlanırsa, kullanıcılar tarafından kesilir, ikincil veritabanı bir geri yükleme işlemi ne zaman gerçekleştirilir.Default = 0.disconnect users is bit and cannot be NULL.

  • [ @ block_size = ] 'block_size'
    The size, in bytes, that is used as the block size for the backup device.block_size is int with a default value of -1.

  • [ @ buffer_count = ] 'buffer_count'
    The total number of buffers used by the backup or restore operation.buffer_count is int with a default value of -1.

  • [ @ max_transfer_size = ] 'max_transfer_size'
    The size, in bytes, of the maximum input or output request which is issued by SQL Server to the backup device.max_transfersize is int and can be NULL.

  • [ @ restore_threshold = ] 'restore_threshold'
    The number of minutes allowed to elapse between restore operations before an alert is generated.restore_threshold is int and cannot be NULL.

  • [ @ 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ı geçirilen belirtir,backup_thresholdaşılıyor.The value of one (1), the default, means that the alert is raised.threshold_alert_enabled is bit.

  • [ @ history_retention_period = ] 'history_retention_period'
    Is the length of time in minutes in which the history is retained.history_retention_period is int, with a default of NULL.Belirtilmezse, 14420 değeri kullanılır.

Dönüş Kodu Değerleri

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

Sonuç Kümeleri

None

Remarks

sp_add_log_shipping_secondary_databaseçalıştırmalısınız ana veritabanından ikincil sunucu. Bu saklı yordam, şunları yapar:

  1. sp_add_log_shipping_secondary_primary adlı veritabanı bilgilerini, sevkiyat birincil günlük başlatmak için bu saklı yordam için önce ikincil sunucu.

  2. İçin bir girdi ekler ikincil veritabanı,log_shipping_secondary_databases kullanılarak sağlanan bağımsız değişkenler.

  3. Yerel izleme kaydı eklerlog_shipping_monitor_secondary sağlanan bağımsız değişkenler. ikincil sunucu kullanma

  4. İzleme sunucu işlemi ikincil sunucuda farklı bir izleme kaydı eklerlog_shipping_monitor_secondary sağlanan bağımsız değişkenler. sunucu monitör kullanma

İzinler

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

Örnekler

Kullanarak bu örnek gösterirsp_add_log_shipping_secondary_databaseLogShipAdventureWorks veritabanı günlük aktarma yapılandırması ile birincil veritabanı AdventureWorksTRIBECA. birincil sunucu üzerinde bulunan ikincil veritabanına eklemek için saklı yordamıyla

EXEC master.dbo.sp_add_log_shipping_secondary_database 
@secondary_database = N'LogShipAdventureWorks' 
,@primary_server = N'TRIBECA' 
,@primary_database = N'AdventureWorks' 
,@restore_delay = 0 
,@restore_mode = 1 
,@disconnect_users = 0 
,@restore_threshold = 45   
,@threshold_alert_enabled = 0 
,@history_retention_period = 1440 
GO