Delete a Phantom Content Database

I’ve encountered this a few times, where a Content Database has gone missing, thus you need to delete a phantom Content Database. When encountering this scenario, typically when creating a Site Collection you’ll receive an error, and in the ULS you’ll find that SharePoint isn’t able to figure out what database to put it in. To determine if the cause is a non-existent database, use the SharePoint Management Shell and run:

If the output looks similar to the following, you have a phantom database.

One might think that simply running Remove-SPContentDatabase -Identity or $db = Get-SPDatabase | ?{$_.Id -eq ""};$db.Delete() would do the trick. Nope! The problem with those methods is they instatinate the database object… which doesn’t exist! Instead, we have to take an alternate approach using the SPWebApplication object via PowerShell.

That will cleanly remove the Content Database object from the Web Application.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.