Removing references to old / unused databases in SharePoint 2010

From this guys site:

Over time, as you create / remove service applications, there is a tendency for SharePoint to retain a list of databases that are no longer in use but still referenced in the SharePoint Config database. If you try to remove the database on the SQL server without first removing it from SharePoint, you will get an event logged periodically on your SharePoint Web Front End about being unable to find / access the missing database.


To remove the orphan databases / databases that are no longer in use.

Run SharePoint Management Shell

Run the command

Get-SPDatabase | fl name,id

Locate the database you wish to remove and copy its ID.
Run the command

$db = Get-SPDatabase (id)

Now type Get-SPDatabase again, you should see that the database(s) have been removed.

Add comment