Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Removing a corrupted merge subscription... Expand / Collapse
Author
Message
Posted Friday, April 26, 2013 8:43 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 11, 2014 12:38 PM
Points: 209, Visits: 637
Hello to all,

Thanks for all your time and assistence and any input is greatly appreciated.

I currently have a server that has merge replication setup on it and of course having some issues. This was setup in a manner that the Server will use a application and take data from about 50 laptop and this is my best option in my eyes. Anyways.. jsut giving a bit of background.

The Publication is on Server A and once of the subscriptions is not allowing me to delete or remove it. When i went to look at the subscriber Laptop A the database that the subscription was created for was deleted by someone else.ggrrr This has since given me problems simply because when i try to remove the subscription Server A tries to connect to the database but its no longer there :-( and then the deletion blows up. Soo i was thinking ok... i can work around this and use some T-SQL code sp_dropmergesubscrition well i try this and when i run it on the Publisher is says completes successfully YET the subscription is still there. There is no right clicking and delete or anything that is going to be THAT simple in this situation.. i could only wish.

I have tried to use the sp_cleanup_subscription thinking it would work after the sp_dropmergesubscription dropped it and again..all commands complete with success but the subsctiption remains.

Would blowing away the distribution database help or make matter worse?

I am thinking of a quick rebuild since early on but see this as a learning opportunity for a situation i have never encountered...Any thoughts or comments are greatly appreciate.
Post #1447046
Posted Sunday, April 28, 2013 8:25 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Yesterday @ 5:33 PM
Points: 743, Visits: 1,067
What parameters you are passing in sp_dropmergesubscription?
take a look in the code of sp_dropmergesubscription and see if you running on any valid sequence. May be SP is running successfully but not doing anything?
Post #1447325
Posted Sunday, April 28, 2013 9:05 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 11, 2014 12:38 PM
Points: 209, Visits: 637
Your response is greatly appreciated...thank you

I think you are right at some level because I am passing all the information to the Publisher but nothing is happening but not sure how you check that to make sure its working. If I do put in wrong data or anything it does error out saying it cant find the subscription or whatever IF I purposely put in incorrect information. So that tells me its making the correct connections on the internals of MSSQL..(unless I am mistaken, which is very possible)

the code looks like this

DECLARE @publication AS sysname;
DECLARE @subscriber AS sysname;
DECLARE @subscriptionDB AS sysname;
DECLARE @subscription_type AS sysname;
SET @publication = N'Sandoval_Publication';
SET @subscriber = $(Client Name);
SET @subscription_type = 'ALL'
SET @subscriptionDB = N'Sanrep';

USE [Sandoval]
EXEC sp_dropmergesubscription
@publication = @publication,
@subscriber = @subscriber,
@subscription_type = @subscription_type
@subscriber_db = @subscriptionDB;
GO

Post #1447327
Posted Sunday, April 28, 2013 2:05 PM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Yesterday @ 5:33 PM
Points: 743, Visits: 1,067
what value SET @subscriber = $(Client Name) is returning ? Do you know subscriber name, so you can pass directly?
Post #1447341
Posted Sunday, April 28, 2013 5:05 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 11, 2014 12:38 PM
Points: 209, Visits: 637
Yes... I do know the client name and cant remember off the top of my head but in that particular statement it was directly to the client and made the connection with no issues.

Sorry for the confusion...the code is going directly to the client when the "Client name" aspects is fill in properly.

Thanks for your time
Post #1447345
Posted Monday, April 29, 2013 4:46 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 11, 2014 12:38 PM
Points: 209, Visits: 637
Not sure why this was this way but it worked so its fixed wooo hooooo

use [database name]
sp_droppublication @publication='publication_name', @ignore_distributor = 1

then restarted the services..and the publication was still there then I tried the following code

USE master
EXEC sp_removedbreplication @dbname='DB_NAME'
GO
exec sp_dropsubscription @subscriber='subscription_name'-- If you find anything under +

exec sp_droppublication 'publication name'

And this above worked and got rid of the orphaned subscriptions and all..wooo hoooo again

I then followed up with dropping the distribution db so that I can start all over from scratch. Which will be perfect and I don't have to do a re-install

--dropping distribution db
use master
go
alter database distribution set offline;
drop database distribution;

Thanks for everyone' s assistance...greatly appreciated.
Post #1447816
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse