locked
Unable to delete an orphanned web application RRS feed

  • Question

  • I tried to delete a web app from Central Admin. It raised an error. The IIS website got deleted. But the clontent db and the reference to the web app did not get removed from the Central Admin. Since then, I have been trying to delete this via powershell with the following being reported:

     Get-SPWebApplication http://myWebAppURL  | Remove-SPWebApplication

    Remove-SPWebApplication : An object in the SharePoint administrative framework, "SPWebApplication Name=myWebAppName", could not be deleted because other objects depend on it.  Update all of these dependants to point to null or different objects and retry this operation.  The dependant objects are as follows:
    At line:1 char:79
    + Get-SPWebApplication myWebAppURL  | Remove-SPWebApplication <<<<
        + CategoryInfo          : InvalidData: (Microsoft.Share...PWebApplication:SPCmdletRemoveSPWebApplication) [Remove-
       SPWebApplication], InvalidOperationException
        + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveSPWebApplication

    Since it does not show what the dependent object is, I have no way of knowing what it is. I don't see any pending timer job for this web application.

    To summarize, the web app is:

    1. Showing in Central Admin
    2. Corresponding IIS sites are gone
    3. Content DB is still there in database

    How do I proceed?


    Thanks, Soumya
    Sunday, September 11, 2011 5:13 AM

Answers

All replies

  • Hi ,

    check this url

    http://dhondiyals.wordpress.com/2010/04/11/resolved-an-object-in-the-sharepoint-administrative-framework-could-not-be-deleted-because-other-objects-depend-on-it/


    Regards, Fadi Abdulwahab. http://sqlgoogler.blogspot.com/ Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
    Sunday, September 11, 2011 5:47 AM
  • Thanks Fadi for directing me to Kailashs' blog. The difference is in his error message has a specific dependent object

    The dependant objects are as follows: SPSolutionDeploymentJobDefinition Name=solution-deployment-mywebpart.wsp-0 Parent=SPTimerService Name=SPTimerV3“.

    However, my error does not give this specific object. That means I don't know what the dependent object is.

     


    Thanks, Soumya
    Sunday, September 11, 2011 3:14 PM
  • Did you try this?

    http://spmike.com/2010/08/13/deleting-orphaned-service-web-application-pools-in-sharepoint-2010



    Aryan Nava | Twitter: @cloudtxt | Blog: http://virtualizesharepoint.com
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you.

    Disclaimer: This posting is provided "AS IS" with no warranties.

    Sunday, September 11, 2011 4:25 PM
  • Yes Aryan. I tried this. The web(service) app pool won't delete saying there is a web application that uses the app pool. On the other hand, I am not able to delete the web app itself that gives the error given in my initial post.
    Thanks, Soumya
    Sunday, September 11, 2011 6:41 PM
  • Although I could not get a very clean resolution, I could get around with this problem by creating a new webapp and attaching the content db to that webapp. However, before doing this, I had to try deleting all orphanned objects from SharePoint. Followed a blog similar to http://sharepointserver-2007.blogspot.com/2008/10/how-to-delete-orphan-configuration.html. Once the above was done, I could create a new webapp and take the content db of the old webapp that I could not delete and attach.
    Thanks, Soumya
    Thursday, October 27, 2011 8:13 PM
  • were you ever able to remove the original "problem" web application? It looks like you were able to recreate a new one and move the content to it, but that you were not able to clean up the original one.

    thanks

    Eric VanRoy

    Tuesday, May 1, 2012 5:17 PM
  • Last time I ran into this, I ended up deleting manually from the config DB without any repurcussion. This is obviously unsupported so the only alternative assuming a corrupt config db is to create a new farm.

    Pranav Sharma
    SharePoint Consultant, Portal Solutions

    Twitter: @ePranav LinkedIn: ePranav Facebook: PortalSolutions Blog: pranavsharma.com About Me: pranavsharma.info

    Tuesday, May 1, 2012 5:59 PM
  • for what it is worth... It was able to be cleared up with a MS call. they had ot look in the sitemap database to determine a GUID and then run powershell commands to delete the non-existent db reference. Highly reoemmend caution when doing this since it would be working directly with GUID's. contact me is you wish the powershell commands.

    Eric VanRoy

    Tuesday, May 15, 2012 4:24 PM
  • Hi Eric,

    I wish the powershell commands if you have time please. May be wtih a little bit of some step by step explanation.


    Thanks, Soumya | MCITP, SharePoint 2010

    Tuesday, May 15, 2012 5:24 PM
  • After determine the GUID of the offending database (it is in the sitemap table of the config database, but it is not supported to query the database itself so you will need to look in a restored backup of that database :) ) then you can execute the following powershell:

    $db-Get-SPDatabase -id <GUID you recovered above>;

    $db  

    $db.Delete()

    This removed the site collection that was causing issues.

    Note: The "$db" step is not needed, but PLEASE do it to verify you have the correct database. If you have the correct one it will have no value for the web applicaiton name, but the Site Collection count will be 1.

    Hope this helps someone else too.

    Eric VanRoy

    • Proposed as answer by SP2013Farmer Tuesday, October 9, 2012 5:56 PM
    Tuesday, May 15, 2012 9:20 PM
  • OK thanks Eric.

    Thanks, Soumya | MCITP, SharePoint 2010

    Tuesday, May 15, 2012 9:27 PM
  • Excellent!  Thanks Eric!

    Here's a method of getting the orphaned databases without having to look in the database:

    $orphans = get-SPDatabase | where{$_.Type -like "Content Database" -and $_.WebApplication -eq $null}
    foreach($db in $orphans){
        $db.Delete()
    }

    • Proposed as answer by Kelly K Smith Tuesday, June 28, 2016 9:38 PM
    Wednesday, March 26, 2014 7:59 PM