sp_refresh_log_shipping_monitor (Transact-SQL)sp_refresh_log_shipping_monitor (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 refreshes the remote monitor tables with the latest information from a given primary or secondary server for the specified log shipping agent. 此过程将在主服务器或辅助服务器上被调用。The procedure is invoked on the primary or secondary server.

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

语法Syntax

  
sp_refresh_log_shipping_monitor  
[ @agent_id = ] 'agent_id',  
[ @agent_type = ] 'agent_type'  
[ @database = ] 'database'  
[ @mode ] n  

参数Arguments

[ @agent_id = ] 'agent_id'用于备份的主 ID 或者用于复制或还原的辅助 ID。[ @agent_id = ] 'agent_id' The primary ID for backup or the secondary ID for copy or restore. agent_iduniqueidentifier ,且不能为 NULL。agent_id is uniqueidentifier and cannot be NULL.

[ @agent_type = ] 'agent_type'日志传送作业的类型。[ @agent_type = ] 'agent_type' The type of log shipping job.

0 = 备份。0 = Backup.

1 = 复制。1 = Copy.

2 = 还原。2 = Restore.

agent_typetinyint ,且不能为 NULL。agent_type is tinyint and cannot be NULL.

[ @database = ] 'database'备份或还原代理按日志记录使用的主或辅助数据库。[ @database = ] 'database' The primary or secondary database used by logging by backup or restore agents.

[ @mode ] n指定是否刷新或清除监视器数据。[ @mode ] n Specifies whether to refresh the monitor data or clean it. M的数据类型为 tinyint,支持的值为:The data type of m is tinyint, and the supported values are:

1 = 刷新(默认值)。1 = refresh (This is the default value.)

2 = 删除2 = delete

返回代码值Return Code Values

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

结果集Result Sets

无。None.

备注Remarks

sp_refresh_log_shipping_monitor将用尚未传输的任何会话信息刷新log_shipping_monitor_primarylog_shipping_monitor_secondarylog_shipping_monitor_history_detaillog_shipping_monitor_error_detail表。sp_refresh_log_shipping_monitor refreshes the log_shipping_monitor_primary, log_shipping_monitor_secondary, log_shipping_monitor_history_detail, and log_shipping_monitor_error_detail tables with any session information that has not already been transferred. 当监视已有一段时间不同步时,您便可以使监视服务器与主服务器或辅助服务器同步。This allows you to synchronize the monitor server with primary or a secondary server when the monitor has been out of sync for awhile. 此外,如果需要,还可以从监视服务器中清除监视信息。Additionally, it allows you to clean up the monitor information on monitor server if necessary.

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

权限Permissions

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

另请参阅See Also

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