I recently had a scenario where I wanted to drop a database (it was replaced by a new system) on a primary SQL server in a 2-way log-shipping setup. It was easy to tear down the log-shipping configuration on the primary and then DROP the database on the secondary but unfortunately this does not remove the log-shipping configuration on the primary when it is set as the secondary in the 2-way scenario. After I had removed the log-shipping configuration for a specific database on primary, and after I DROPPED the database on the secondary, I also need to run the T-SQL below to complete the tear-down of the 2-way log-shipping for the database
1 2 3 4 5 6 7 |
-- Execute this code on the PRIMARY in a 2-way log-shipping scenario USE master; GO SELECT * FROM msdb.dbo.log_shipping_secondary_databases lssd EXEC sp_delete_log_shipping_secondary_database N'AdventureWorks2014' |
See also my older blog post: Log-shipping Queries
Ref:
Manually remove log shipping using T-SQL
Views – 2790