Additional SQL Server features and topics not covered by specific categories
Based on the analysis, there appear to be two separate issues in the distribution database:
- The dropped article's publication (database 9, from 17-Feb-2025 onward)
The article has been dropped, but the publication and its subscription still exist. Since that subscription is still a registered destination, the cleanup process continues to account for it, which is likely why these transactions remain. Dropping the subscription and then the empty publication should allow these transactions to be released:
-- On the Publisher, in the published database
EXEC sp_dropsubscription
@publication = 'YourPublication',
@article = 'all',
@subscriber = 'ReportingServerB',
@destination_db = 'SubscriberDB'
EXEC sp_droppublication
@publication = 'YourPublication'
After running this, it would be worth running a cleanup pass and checking whether MIN(entry_time) for publisher_database_id = 9 moves forward.
- The Test DB rows (Dec-2024, publisher_database_id 1, 2, 4, 7, 8)
This points to orphaned distribution metadata left behind by an incomplete removal.
It's worth noting that the dropped article's entries would only persist in the same way if its removal is incomplete. If the subscription and empty publication are dropped cleanly, the transactions should become eligible and get cleaned up.
To diagnose the orphans, you could run the following in the distribution database:
USE distribution;
GO
SELECT publisher_database_id, publication_id, article_id, subscriber_id
FROM dbo.MSsubscriptions
ORDER BY publisher_database_id
SELECT id, publisher_database_id, publication, subscriber_db, subscription_type
FROM dbo.MSdistribution_agents
ORDER BY publisher_database_id