sp_help_log_shipping_primary_database (Transact-SQL)sp_help_log_shipping_primary_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

检索主数据库设置。Retrieves primary database settings.

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


[ @database = ] 'database' OR  
[ @primary_id = ] 'primary_id'  


[ @database = ] 'database'日志传送主数据库的名称。[ @database = ] 'database' Is the name of the log shipping primary database. 数据库sysname,无默认值,且不能为 NULL。database is sysname, with no default, and cannot be NULL.

[ @primary_id = ] 'primary_id'日志传送配置的主数据库 ID。[ @primary_id = ] 'primary_id' The ID of the primary database for the log shipping configuration. primary_iduniqueidentifier ,且不能为 NULL。primary_id is uniqueidentifier and cannot be NULL.

返回代码值Return Code Values

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

结果集Result Sets

列名称Column name 说明Description
primary_idprimary_id 日志传送配置的主数据库 ID。The ID of the primary database for the log shipping configuration.
primary_databaseprimary_database 日志传送配置中主数据库的名称。The name of the primary database in the log shipping configuration.
backup_directorybackup_directory 存储主服务器的事务日志备份文件的目录。The directory where transaction log backup files from the primary server are stored.
backup_sharebackup_share 备份目录的网络或 UNC 路径。The network or UNC path to the backup directory.
backup_retention_periodbackup_retention_period 日志备份文件在删除之前保留在备份目录中的时间长度(分钟)。The length of time, in minutes, that a log backup file is retained in the backup directory before being deleted.
backup_compressionbackup_compression 指示日志传送配置是否使用备份压缩Indicates whether the log shipping configuration uses backup compression.

0 = 禁用。0 = Disabled. 从不压缩日志备份。Never compress log backups.

1 = 已启用。1 = Enabled. 始终压缩日志备份。Always compress log backups.

2 = 使用视图的设置或配置备份压缩默认服务器配置选项2 = Use the setting of the View or Configure the backup compression default Server Configuration Option. 这是默认值。This is the default value.

只有 SQL Server 2008 EnterpriseSQL Server 2008 Enterprise(或更高版本)支持备份压缩。Backup compression is supported only in SQL Server 2008 EnterpriseSQL Server 2008 Enterprise (or a later version). 在其他版本中,该值始终为 2。In other editions, the value is always 2.
backup_job_idbackup_job_id 与主服务器上的备份作业相关联的 MicrosoftMicrosoft SQL ServerSQL Server 代理作业 ID。The MicrosoftMicrosoft SQL ServerSQL Server Agent job ID associated with the backup job on the primary 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.
backup_thresholdbackup_threshold 备份操作之间的占用时间阈值(分钟),一旦超过此值,就会生成警报。The number of minutes allowed to elapse between backup operations before an alert is generated.
threshold_alertthreshold_alert 超过备份阈值时引发的警报。The alert to be raised when the backup threshold is exceeded.
threshold_alert_enabledthreshold_alert_enabled 确定是否启用备份阈值警报。Determines if backup threshold alerts are enabled.

1 = 已启用。1 = Enabled.

0 = 禁用。0 = Disabled.
last_backup_filelast_backup_file 最近一次事务日志备份的绝对路径。The absolute path of the most recent transaction log backup.
last_backup_datelast_backup_date 上一次日志备份操作的时间和日期。The time and date of the last log backup operation.
last_backup_date_utclast_backup_date_utc 上一次在主数据库上执行事务日志备份操作的时间和日期,使用协调世界时表示。The time and date of the last transaction log backup operation on the primary 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 primary database before being deleted.


必须从主服务器上的master数据库运行sp_help_log_shipping_primary_databasesp_help_log_shipping_primary_database must be run from the master database on the primary server.


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


此示例演示如何使用sp_help_log_shipping_primary_database检索数据库AdventureWorks2012AdventureWorks2012的主数据库设置。This example illustrates using sp_help_log_shipping_primary_database to retrieve primary database settings for the database AdventureWorks2012AdventureWorks2012.

EXEC master.dbo.sp_help_log_shipping_primary_database @database=N'AdventureWorks2012';  

另请参阅See Also

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