Removing Log-shipping from a Secondary in a 2-way Log-shipping Scenario

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

See also my older blog post: Log-shipping Queries

Ref:
Manually remove log shipping using T-SQL

Views – 2790