SharePoint 2010 | How to delete orphaned Web Application

English Orphaned web application? I don’t know how it happened - but let call the symptoms orphaned web application. Definition Orphaned web application is a situation where you can not performed essential modification to the web application such as adding new content databases, remove extended IIS, delete web application or create new site collection. In short, the web application exists but it doesn’t work and Administrator can not remove it.  Symptoms You will experience any of following symptoms:

  1. Site collection are dissapear unexpectedly When you open Site Collection List for particular web application ([CA]/_admin/SiteCollections.aspx?ReturnSelectionPage=/applications.aspx), all site collection that you believe exist in that web application are missing. No operation such as content database removal has been done on that web application.  
  2. You can not add missing content database using Manage Content Databases page Content database for the web application suddently not listed in Manage Content Database page ([CA]/_admin/CNTDBADM.aspx). When you try to add the same content database, SharePoint returns error stating that database with same GUID already exists.
  3. You can not add missing content database using Mount-SPContentDatabase Using the recomendation from SharePoint’s error message,  you try to use Mount-SPContentDatabase -AssignNewDatabaseId powershell command ; but still the problem continue. You can not add missing content database.
  4. You can not delete problematic Web Application When you try to delete the web application using PowerShell or StsAdm ; SharePoint will reject the operation and return error. You simply can not delete the problematic Web Application because it has other objects depend on it. However, no pending job for the web application, no content database and no indication from Central Administration or any PowerShell command.

Orphan1 Resolution Basically the key poin in this resolution is to find any orphan objects related with the Web Application in the Configuration database, and remove the object completely from Configuration database using SharePoint’s command.

  1. Open Config DB of the farm using SQL Server Management Studio.
  2. To find the Web Application GUID, run following querySELECT * FROM OBJECTS WHERE Properties like ‘%.SPWebApplication%’ and Name =’[WEB APPLICATION NAME]Take note to Id column value!
  3. To find the Content Database SELECT * FROM OBJECTS WHERE Properties like ‘%.SPContentDatabase%’ and Name =’[CONTENT DATABASE NAME]Take note to Id column value!
  4. Always take note to Id column value, and cross check if the Name is the the exact object that you are looking for.
  5. Start to delete Content Database ID from Configuration database, using following command stsadm -o  deleteconfigurationobject -id [Content DB Object ID]
  6. STOP! Once Content DB Object ID has been removed. You must try to use normal operation to delete the Web Application. Try to use Remove-SPWebApplication command in PowerShell. If this command sucessfull, then you can re-create the Web Application and re-attach original content database. However, if you still fail ; you can enforce using stsadm -o deleteconfigurationobject  with [Web Application ID] as removal target object id.
Riwut Libinuko
Sr. Cloud Solution Architect

My research interests include distributed robotics, mobile computing and programmable matter.

comments powered by Disqus