This stored procedure removes log shipping of primary database including backup job as well as local and remote history. Only use this stored procedure after you have removed the secondary databases using sp_delete_log_shipping_primary_secondary.
sp_delete_log_shipping_primary_database must be run from the master database on the primary server. This stored procedure does the following:
Deletes the backup job for the specified primary database.
Removes the local monitor record in log_shipping_monitor_primary on the primary server.
Removes corresponding entries in log_shipping_monitor_history_detail and log_shipping_monitor_error_detail.
If the monitor server is different from the primary server, removes the monitor record in log_shipping_monitor_primary on the monitor server.
Removes corresponding entries in log_shipping_monitor_history_detail and log_shipping_monitor_error_detail on the monitor server.
Removes the entry in log_shipping_primary_databases for this primary database.
Calls sp_delete_log_shipping_alert_job on the monitor server.
This example illustrates using sp_delete_log_shipping_primary_database to delete the primary database AdventureWorks2008R2.
EXEC master.dbo.sp_delete_log_shipping_primary_database @database = N'AdventureWorks2008R2'; GO