SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Removing a corrupted merge subscription...


Removing a corrupted merge subscription...

Author
Message
DHeath
DHeath
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1585 Visits: 657
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.
Neeraj Dwivedi
Neeraj Dwivedi
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3301 Visits: 1341
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?
DHeath
DHeath
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1585 Visits: 657
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
Neeraj Dwivedi
Neeraj Dwivedi
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3301 Visits: 1341
what value SET @subscriber = $(Client Name) is returning ? Do you know subscriber name, so you can pass directly?
DHeath
DHeath
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1585 Visits: 657
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
DHeath
DHeath
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1585 Visits: 657
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search