SQL Server Replication : Removing broken subscriptions at the publisher

Master Zang picture Master Zang · Oct 24, 2011 · Viewed 7.4k times · Source

We have multiple subscriptions (merge pull) at our subscriber for only 1 "real" subscription. I think we actually broke it like this by adding and removing the subscription from the subscriber side, and then trying to replicate it... multiple times.

Now the problem is not that the replication does not work, I'm pretty confident that I the answer for that. The problem is that I can't drop/delete the broken subscriptions at the subscriber anymore. It just does not work.

When trying to run sp_dropmergepullsubscription at the publisher, it tells me "No subscription is on this publication article".

When trying to run sp_dropsubscription at the publisher, it tells me "This database is not enabled for subscription"

Yes I've checked that I was running all these scripts on the correct database and all that.

Has anybody had a problem like this before ? Do I need to re-do the publication and the subscription ?

Thanks guys and gals ! :)

Answer

Quantum Elf picture Quantum Elf · Oct 24, 2011

Try the following on the publisher:

EXEC sp_dropmergesubscription 
  @publication = '<publicationName>', 
  @subscriber = '<subscriberName>',
  @subscriber_db = '<dbName>;
GO

delete sysmergesubscriptions where subscriber_server = '<subscriberName>'

use distribution
go 
delete msmerge_Agents where subscriber_name = '<subscriberName>'

delete msmerge_subscriptions where subscriber = '<subscriberName>' 

...then try setting the pull subscription back up