Aracılığıyla paylaş


sp_add_log_shipping_secondary_primary (Transact-SQL)

Birincil bilgilerini ayarlar, yerel ve uzak monitör bağlantılar ekler ve ikincil sunucu için belirtilen birincil veritabanı kopyalama ve geri yükleme işi oluşturur.

Topic link iconTransact-SQL sözdizimi kuralları

sp_add_log_shipping_secondary_primary
 [ @primary_server = ] 'primary_server', 
[ @primary_database = ] 'primary_database',
[ @backup_source_directory = ] 'backup_source_directory' , 
[ @backup_destination_directory = ] 'backup_destination_directory'
[ @copy_job_name = ] 'copy_job_name'
[ @restore_job_name = ] 'restore_job_name'
[, [ @file_retention_period = ] 'file_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']
[, [ @copy_job_id = ] 'copy_job_id' OUTPUT ]
[, [ @restore_job_id = ] 'restore_job_id' OUTPUT ]
[, [ @secondary_id = ] 'secondary_id' OUTPUT]

Bağımsız değişkenler

  • [ @ 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.

  • [ @ backup_source_directory = ] 'backup_source_directory'
    The directory where transaction log backup files from the primary server are stored.backup_source_directory is nvarchar(500) and cannot be NULL.

  • [ @ backup_destination_directory = ] 'backup_destination_directory'
    The directory on the secondary server where backup files are copied to.backup_destination_directory is nvarchar(500) and cannot be NULL.

  • [ @ copy_job_name = ] 'copy_job_name'
    The name to use for the SQL Server Agent job being created to copy transaction log backups to the secondary server.copy_job_name is sysname and cannot be NULL.

  • [ @ restore_job_name = ] 'restore_job_name'
    Is the name of the SQL Server Agent job on the secondary server that restores the backups to the secondary database.restore_job_name is sysname and cannot be NULL.

  • [ @ file_retention_period = ] 'file_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.

  • [ @ 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 kimlik doğrulaması.

    monitor_server_security_mode olan bit NULL olamaz.

  • [ @ 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.

  • [ @ copy_job_id = ] 'copy_job_id' ÇIKTI
    The ID associated with the copy job on the secondary server.copy_job_id is uniqueidentifier and cannot be NULL.

  • [ @ restore_job_id = ] 'restore_job_id' ÇIKTI
    The ID associated with the restore job on the secondary server.restore_job_id is uniqueidentifier and cannot be NULL.

  • [ @ secondary_id = ] 'secondary_id' ÇIKTI
    The ID for the secondary server in the log shipping configuration.secondary_id is uniqueidentifier and cannot be NULL.

Dönüş Kodu Değerleri

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

Sonuç Kümeleri

None

Remarks

sp_add_log_shipping_secondary_primary çalıştırılmalıdır.Yönetici veritabanında ikincil sunucu.Bu saklı yordam, şunları yapar:

  1. Belirtilen birincil sunucu ve birincil veritabanı için ikincil bir KIMLIK oluşturur.

  2. Aşağıdakileri yapar:

    1. ' De ikincil KIMLIĞI için bir girdi ekler. log_shipping_secondary sağlanan bağımsız değişken kullanma.

    2. Bir kopya oluşturur iş devre dışı bırakılan bir ikincil kimliği.

    3. Kopyalama işlemini KIMLIĞINI ayarlar log_shipping_secondary girdi kopyalama işini iş KIMLIĞI.

    4. Bir geri yükleme işi için devre dışı ikincil KIMLIĞI oluşturur.

    5. küme geri yükleme iş KIMLIĞI log_shipping_secondary girdi geri yükleme işi iş KIMLIĞI.

İzinler

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

Örnekler

Bu örneği kullanarak gösterir sp_add_log_shipping_secondary_primary yordamına depolanan küme için birincil bilgi veritabanıAdventureWorks ikincil sunucuda.

EXEC master.dbo.sp_add_log_shipping_secondary_primary 
@primary_server = N'TRIBECA' 
,@primary_database = N'AdventureWorks' 
,@backup_source_directory = N'\\tribeca\LogShipping' 
,@backup_destination_directory = N'' 
,@copy_job_name = N'' 
,@restore_job_name = N'' 
,@file_retention_period = 1440 
,@monitor_server = N'ROCKAWAY' 
,@monitor_server_security_mode = 1 
,@copy_job_id = @LS_Secondary__CopyJobId OUTPUT 
,@restore_job_id = @LS_Secondary__RestoreJobId OUTPUT 
,@secondary_id = @LS_Secondary__SecondaryId OUTPUT 
GO