We have recently had a lot of customers raise issue regards SharePoint application patching. After digging around in the logs using ULS viewer you may find the following error or something similar to this:

Errors can also be shown in SharePoint Central Administrator health page, this is also another way to get the ID’s necessary to fix the issue. This particular example is essentially saying a feature/application (9d89aab7-508e-40d0-9eaa-cf94efb50b96) is no longer installed on the farm however is still referenced in one of the content DBs.

To resolve this you will need to open SQL Server Management Studio on the server where your content DBs reside on. Then open a new query:

SELECT SiteID, WebID, FeatureID
FROM [**YOUR CONTENT DB].[dbo].[Features] With (NoLOCK)
WHERE FeatureID IN (“9d89aab7-508e-40d0-9eaa-cf94efb50b96”)

The output will give you the Site ID, Web ID and feature ID however please note if the Web ID is showing just 0’s this means it is a site scope feature. If you have information in both the Site ID and Web ID the feature is a web scope feature. Now we have all of the require information we will need to clean up the DBs.

To fix a site scope feature you will need to run the following commands:

$site = Get-SPSite -Limit All | ?{$_.ID -eq “SITE ID”}
$siteFeature = $site.Features[“9d89aab7-508e-40d0-9eaa-cf94efb50b96”]
$site.Features.Remove($siteFeature.DefinitionId, $true)

To resolve a web scope feature run the following commands:

$site = Get-SPSite -Limit all | where { $_.Id -eq “SITE ID” }
$web = $site | Get-SPWeb -Limit all | where { $_.Id -eq “WEB ID” }
$webFeature = $web.Features[“9d89aab7-508e-40d0-9eaa-cf94efb50b96”]
$web.Features.Remove($webFeature.DefinitionId, $true)

Once this is done you can force a check of the health of the alert in Central Administrator and this should then show that the issue is cleared.

Thanks for reading!