sp_help_log_shipping_secondary_database (Transact-SQL)sp_help_log_shipping_secondary_database (Transact-SQL)

适用对象: 是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

此存储过程可检索一个或多个辅助数据库的设置。This stored procedure retrieves the settings for one or more secondary databases.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_help_log_shipping_secondary_database  
[ @secondary_database = ] 'secondary_database' OR  
[ @secondary_id = ] 'secondary_id'  

参数Arguments

[ @secondary_database = ] 'secondary_database'辅助数据库的名称。[ @secondary_database = ] 'secondary_database' Is the name of the secondary database. secondary_database sysname,无默认值。secondary_database is sysname, with no default.

[ @secondary_id = ] 'secondary_id'日志传送配置中辅助服务器的 ID。[ @secondary_id = ] 'secondary_id' The ID for the secondary server in the log shipping configuration. secondary_iduniqueidentifier ,且不能为 NULL。secondary_id is uniqueidentifier and cannot be NULL.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

结果集Result Sets

列名称Column name 说明Description
secondary_idsecondary_id 日志传送配置中辅助服务器的 ID。The ID for the secondary server in the log shipping configuration.
primary_serverprimary_server 日志传送配置中 MicrosoftMicrosoft SQL Server 数据库引擎SQL Server Database Engine主实例的名称。The name of the primary instance of the MicrosoftMicrosoft SQL Server 数据库引擎SQL Server Database Engine in the log shipping configuration.
primary_databaseprimary_database 日志传送配置中主数据库的名称。The name of the primary database in the log shipping configuration.
backup_source_directorybackup_source_directory 存储主服务器的事务日志备份文件的目录。The directory where transaction log backup files from the primary server are stored.
backup_destination_directorybackup_destination_directory 备份文件复制到的辅助服务器上的目录。The directory on the secondary server where backup files are copied to.
file_retention_periodfile_retention_period 备份文件被删除之前在辅助服务器上保留的时间(以分钟为单位)。The length of time, in minutes, that a backup file is retained on the secondary server before being deleted.
copy_job_idcopy_job_id 与辅助服务器上的复制作业关联的 ID。The ID associated with the copy job on the secondary server.
restore_job_idrestore_job_id 与辅助服务器上的还原作业关联的 ID。The ID associated with the restore job on the secondary server.
monitor_servermonitor_server 在日志传送配置中用作监视服务器的 SQL Server 数据库引擎SQL Server Database Engine 实例的名称。The name of the instance of the SQL Server 数据库引擎SQL Server Database Engine being used as a monitor server in the log shipping configuration.
monitor_server_security_modemonitor_server_security_mode 用于连接到监视服务器的安全模式。The security mode used to connect to the monitor server.

1 = MicrosoftMicrosoft Windows 身份验证。1 = MicrosoftMicrosoft Windows Authentication.

0 = SQL ServerSQL Server身份验证。0 = SQL ServerSQL Server Authentication.
secondary_databasesecondary_database 日志传送配置中辅助数据库的名称。The name of the secondary database in the log shipping configuration.
restore_delayrestore_delay 辅助服务器在还原给定备份文件之前等待的时间(分钟)。The amount of time, in minutes, that the secondary server waits before restoring a given backup file. 默认为 0 分钟。The default is 0 minutes.
restore_allrestore_all 如果设置为 1,则在运行还原作业时,辅助服务器将还原所有可用的事务日志备份。If set to 1, the secondary server restores all available transaction log backups when the restore job runs. 否则,在原还了一个文件之后它将停止。Otherwise, it stops after one file has been restored.
restore_moderestore_mode 辅助数据库的还原模式。The restore mode for the secondary database.

0 = 用 NORECOVERY 还原日志。0 = Restore log with NORECOVERY.

1 = 使用 STANDBY 还原日志。1 = Restore log with STANDBY.
disconnect_usersdisconnect_users 如果设置为 1,则在执行还原操作时,会断开用户与辅助数据库的连接。If set to 1, users are disconnected from the secondary database when a restore operation is performed. 默认值 = 0。Default = 0.
block_sizeblock_size 用作备份设备的块大小(字节)。The size, in bytes, that is used as the block size for the backup device.
buffer_countbuffer_count 备份或还原操作使用的缓冲区总数。The total number of buffers used by the backup or restore operation.
max_transfer_sizemax_transfer_size
SQL ServerSQL Server 向备份设备发出的最大输入或输出请求的大小(字节)。The size, in bytes, of the maximum input or output request which is issued by SQL ServerSQL Server to the backup device.
restore_thresholdrestore_threshold 两次还原操作之间允许的间隔时间(分钟),一旦超过此值,就会生成警报。The number of minutes allowed to elapse between restore operations before an alert is generated.
threshold_alertthreshold_alert 超过还原阈值时引发的警报。The alert to be raised when the restore threshold is exceeded.
threshold_alert_enabledthreshold_alert_enabled 确定是否启用了还原阈值警报。Determines if restore threshold alerts are enabled.

1 = 启用。1 = Enabled.

0 = 禁用。0 = Disabled.
last_copied_filelast_copied_file 上次复制到辅助服务器的备份文件的文件名。The filename of the last backup file copied to the secondary server.
last_copied_datelast_copied_date 上次复制到辅助服务器的时间和日期。The time and date of the last copy operation to the secondary server.
last_copied_date_utclast_copied_date_utc 上次对辅助服务器执行复制操作的时间和日期,以通用协调时间表示。The time and date of the last copy operation to the secondary server, expressed in Coordinated Universal Time.
last_restored_filelast_restored_file 上次还原到辅助数据库的备份文件的文件名。The filename of the last backup file restored to the secondary database.
last_restored_datelast_restored_date 上次对辅助数据库执行还原操作的时间和日期。The time and date of the last restore operation on the secondary database.
last_restored_date_utclast_restored_date_utc 上次对辅助数据库执行还原操作的时间和日期,以通用协调时间表示。The time and date of the last restore operation on the secondary database, expressed in Coordinated Universal Time.
history_retention_periodhistory_retention_period 日志传送历史记录在删除前保留在给定辅助数据库中的时间(分钟)。The amount of time, in minutes, that log shipping history records are retained for a given secondary database before being deleted.
last_restored_latencylast_restored_latency 在主数据库上创建日志备份的时间与在辅助数据库上还原日志备份的时间间隔(分钟)。The amount of time, in minutes, that elapsed between when the log backup was created on the primary and when it was restored on the secondary.

初始值为 NULL。The initial value is NULL.

备注Remarks

如果包含secondary_database参数,则结果集将包含有关该辅助数据库的信息;如果包括secondary_id参数,则结果集将包含与该辅助 id 相关联的所有辅助数据库的相关信息。If you include the secondary_database parameter, the result set will contain information about that secondary database; if you include the secondary_id parameter, the result set will contain information about all secondary databases associated with that secondary ID.

必须从辅助服务器上的master数据库运行sp_help_log_shipping_secondary_databasesp_help_log_shipping_secondary_database must be run from the master database on the secondary server.

权限Permissions

只有sysadmin固定服务器角色的成员才能运行此过程。Only members of the sysadmin fixed server role can run this procedure.

另请参阅See Also

sp_help_log_shipping_secondary_primary (Transact-sql) sp_help_log_shipping_secondary_primary (Transact-SQL)
关于日志传送 (SQL Server) About Log Shipping (SQL Server)
系统存储过程 (Transact-SQL)System Stored Procedures (Transact-SQL)