Tuesday, June 1, 2010

Removing a Server from your Farm

I recently had a problem with a Database server that just did not want to be removed from the FARM.

Looking into it I first tried to remove the server from the FARM via Central Administration

Go to Central Administration Operations Servers in Farm.
Tried to remove the server. This gave me the following error:

An object in the SharePoint administrative framework, "SPDatabaseServiceInstance Parent=SPServer Nam
e=buildserver", could not be deleted because other objects depend on it. Update all of these depend
ants to point to null or different objects and retry this operation. The dependant objects are as follows:


so I followed this guys blog:

Basically to go and find it in the Content Database and delete the depenencies manually.

Still, I did not get any reference. So in short it said that there was a dependency but actually there wasn't any. This led me to thinking something else kept the reference.

I then did something I would not recommend but had no option, (it was a QA environment as well), but I removed the
Foreign Key on my SharePoint_Config Dependencies table:

USE [SharePoint_Config]
ALTER TABLE [dbo].[Dependencies] WITH CHECK ADD CONSTRAINT [FK_Dependencies1_Objects] FOREIGN KEY([ObjectId])
REFERENCES [dbo].[Objects] ([Id])

Then I ran my deleteconfigurationobject -id problemguid

It succeeded.
My problem DB Server was removed.

I then , wanted to add back my constraint since its there for a reason.. thinking it might fail, it did. There was a problem adding the constraint back because it clashed on the dependency. Probably the original dependency that caused the whole thing.

So then I waited a while, and then ran the Constraint Creation again.
Lo and behold . It now allowed me to add it again without a constraint warning.

All is back as it should and working.
My suspicion is a service of some sorts kept this dependency locked.

I normally don't suggest touching the SharePoint DB's but in this case , all roads failed and I had to get my hands dirty in a controlled way.