共用方式為


sp_cleanup_log_shipping_history (Transact-SQL)

適用於:SQL Server

此預存程式會根據保留期間,在本機和監視伺服器上清除歷程記錄。

Transact-SQL 語法慣例

語法

  
sp_cleanup_log_shipping_history  
[ @agent_id = ] 'agent_id',  
[ @agent_type = ] 'agent_type'  

引數

[ @agent_id = ] 'agent_id', 備份的主要標識碼,或複製或還原的次要標識符。 agent_id是 uniqueidentifier,而且不能是 NULL。

[ @agent_type = ] 'agent_type' 記錄傳送作業的類型。 0 = 備份,1 = 複製,2 = 還原。 agent_type為 tinyint,不能為 NULL。

傳回碼值

0 (成功) 或 1 (失敗)

結果集

無。

備註

sp_cleanup_log_shipping_history必須在任何記錄傳送伺服器上從 master 資料庫執行。 此預存程式會根據歷程記錄保留期間,清除log_shipping_monitor_history_detaillog_shipping_monitor_error_detail本機和遠端複本。

權限

只有系統管理員固定伺服器角色的成員才能執行此程式。

另請參閱

關於記錄傳送 (SQL Server)
系統預存程序 (Transact-SQL)