Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

sp_cleanup_log_shipping_history (Transact-SQL)


THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

This stored procedure cleans up history locally and on the monitor server based on retention period.

Topic link icon Transact-SQL Syntax Conventions

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

[ @agent_id = ] 'agent_id',
The primary ID for backup or the secondary ID for copy or restore. agent_id is uniqueidentifier and cannot be NULL.

[ @agent_type = ] 'agent_type'
The type of log shipping job. 0 = Backup, 1 = Copy, 2 = Restore. agent_type is tinyint and cannot be NULL.

0 (success) or 1 (failure)


sp_cleanup_log_shipping_history must be run from the master database on any log shipping server. This stored procedure cleans up local and remote copies of log_shipping_monitor_history_detail and log_shipping_monitor_error_detail based on history retention period.

Only members of the sysadmin fixed server role can run this procedure.

About Log Shipping (SQL Server)
System Stored Procedures (Transact-SQL)

Community Additions

© 2016 Microsoft