Thursday, February 26, 2009

Deleting object from SharePoint configuration database

I learned today that there is a very useful, but semi-hidden command that STSADM has called deleteconfigurationobject. From what I can tell, it deletes an object from the configuration database. Use caution when using this. I have used it when I need to delete a web site, web site application pool, database from the configuration database so that I can create a new one. This is particularly helpful when something gets corrupt.

The syntax is

STSADM -o deleteconfigurationobject -id "<object id>"

To figure out what the object id is, you will need to use SQL.

To find the object id easiest way is to just search by the common name of the object. To do that, follow these instructions.

  1. Open MS SQL Management Studio and open a new Query tab for the configuration database. Typically, this is the database with Config in it. Depending on the installation of SharePoint this could have been set to something else when it was installed.
  2. Do a query similar to the following
    select id from [Objects] where [Name] like '%MySite%'
  3. Copy the id, which is a GUID, and execute the STSADM -o deleteconfigurationobject -id command on the SharePoint server.


Doug Roulo said...

When you did used this to delete a website did you query the sitemap table and then just use the object ID for the site in the command? Lots of posts seem like it only deletes the object from the object table.

Brent V said...

Hi Doug,

Do you have any more information on what needs to be done with the sitemap table. I am not familiar with it. If you have an example, that would be great.



Anonymous said...


We have the similar issue, where a site collection refernce is avaible in the sitemap table of Configuration database, but that site collection is not available in the content database. Due to which the crawling is not happening in that content databse where the orphaned site collection resided