Cannot delete Host header site collections in Central Admin

I was recently trying to create some host header site collections to my new SharePoint 2013 farm. My first 2 attempts failed because I did not have enough rights to the content DB where the site collections would be created.

s—spsite : Cannot open database “lISS_Content_Intranet” requested by the 
gin. The login failed. 
gin failed for user ‘CORP\SPINSTALL’. 
1 line:1. char:1 
iew—spsite ‘xxxxxxxxxxxxx.com/internal/hr” —owneralias 
t orp\spinstal... ____________________ 
+ Categorylnfo : InualidData: (Microsoft.Share. . .SPCndletNewSite: 
SPCndletNewSite) [New—SPSite], SqlException 
+ FullyQualifiedErrorid : tlicrosoft.SharePoint.PowerShell.SPCndletNewSite

Once I added the proper rights, I tried the command again, only to be told that those site collections already existed. When I go to the view all site collections page in Central Admin I see my phantom site collections in the list. Highlighting it however, reveals no metadata on the right as you would expect. compare the below images. the first is my phantom site collection. the second is a proper one.

pic21

pic31

I tried to delete these rogue entries , only to be told they did not exist. Clearly a bug here, but how to fix it? I stumbled upon 1 simple solution while working on a different issue. Follow these basic steps (Dont try this if you are in the middle of an upgrade. this assumes you dont have any upgradeable databases)

I have a mix of powershell and central admin here. You could do this all with powershell or all with the UI. This is just how I did it.

1. create a test web application. you can delete it when you are done.
2. in central admin, on the content database page remove the content db from the new test web app (or use powershell)
3. now remove the content db from your actual web app where you are having the issue using the same process as step 2
4. attach your content db with the rogue site collection entries from your actual web app to the test web app. here is a powershell command (you can do this in the UI as well)

Mount-SPContentDatabase “MyDatabase” -DatabaseServer “MyServer” -WebApplication http://sitename

5. now you can browse to the list of site collections in central admin under this test web app and you should see that the phantom site collections are gone.

6. once again, remove the content db from the test web app

7. once again, attach the content db back to the original web app and you should be good to go

8. delete the test web app and unused content database created with it.

It may be that just removing and reatttaching the content db from the original web app may be sufficient without the need for the test web app. that may be worth a try first. I was researching another issue and found to my surprise that my phantom site collection issue had been solved.

Advertisements

One thought on “Cannot delete Host header site collections in Central Admin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s