Additional SQL Server features and topics not covered by specific categories
Transactions are per-publisher-database. One publisher transaction touching multiple articles produces one MSrepl_transactions row plus multiple MSrepl_commands rows tagged by article. The cleanup low-water mark advances per publisher_database_id, and sp_MSdistribution_cleanup only purges a transaction when all its commands are eligible across all subscriptions for that database. So if any article or subscription on database 9 still references a range of transactions, the whole range for database 9 stays put.
Two separate problems in your data:
- The dropped article's publication (database 9, 17-Feb-2025 onward). You dropped the article, but the publication (now 0 articles) and its subscription still exist. That subscription is still a registered destination cleanup accounts for. Dropping the subscription then the empty publication should release these transactions.
-- On Publisher, in the published database
EXEC sp_dropsubscription
@publication = 'YourPublication',
@article = 'all',
@subscriber = 'ReportingServerB',
@destination_db = 'SubscriberDB';
EXEC sp_droppublication
@publication = 'YourPublication';
Then run one cleanup pass and check whether MIN(entry_time) for publisher_database_id = 9 moves forward. It should, provided no other article on database 9 still pins those same xact_seqnos. Confirm push vs pull first: if pull, also run sp_droppullsubscription on the subscriber.
- The Test DB rows (Dec-2024, publisher_database_id 1, 2, 4, 7, 8). You dropped those publications and databases long ago, yet the transactions persist. That's orphaned distribution metadata from an incomplete removal, cleanup still thinks something needs them, so it never purges them.
The dropped article's entries persist too only if its removal is incomplete. If you drop the subscription and empty publication cleanly, the transactions become eligible and get cleaned. The Test DBs prove that incomplete removal leaves permanent orphans. The difference is entirely whether the metadata is fully gone afterward.
Diagnose the orphans (run in distribution DB):
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;
Check whether ids 1, 2, 4, 7, 8 still appear. If they do, those leftover rows are what pin the Dec-2024 low-water mark.