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_detail log_shipping_monitor_error_detail 本機和遠端複本。

權限

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

另請參閱

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