CodeProject
Quite recently, I have successfully managed the site-collection environment movement from the staging to the live hosting infrastructure with all the corresponding content and permissions. Then, we looked into the "Health Analyzer" from the central administration to find out a few interesting errors, which basically is complaining about "Missing Server side dependencies".
After fiddling around a bit, it turns out that some 3rd-party web-part hasn't been re-installed on the new production environment, which leads to this error to ask me to "Please install any feature/solution which contains this web. One or more web pages are referenced in the database".
Well, it occurs to me that the quickest way to work out the solution is to re-install the 3rd web parts all over again, then turn the features on, then reset the web server, then the problem goes away.
After going through all that, sadly, it didn't work out at all, which got me thinking about what the relationship between the web-parts and pages, because the part of the error message kept saying "WebPart class [xxxxx-xxxxx-xxxxx-xxxxx-xxxxx]" is referenced [11] times on the current farm". Based on that, it must be referenced in the content database somewhere about this information, so that it could keep tracking of all those relationship and load them up into the page load.
After opening the pandora box (Site-collection content database), I came up the following SQL query to narrow down what pages in this particular site collection has been referenced by those 3rd-party web parts.
SELECT distinct Webs.FullUrl, Webs.Title, AllDocs.DirName, AllDocs.LeafName
FROM AllDocs, Sites, AllWebParts, Webs
WHERE Webs.Id = Sites.RootWebId
AND AllDocs.Id = AllWebParts.tp_PageUrlID
AND Sites.Id = AllDocs.SiteId
AND tp_WebPartTypeId IN (
SELECT DISTINCT tp_WebPartTypeId FROM AllWebParts (NOLOCK)
WHERE tp_WebPartTypeId = 'WebPartClassId')
Once those pages are revealed, all I need to do is to delete site-collection, then remove them from recycle-bin, lastly remove them from site-collection recycle-bin.
After a quick iisreset, magically, the issue has gone away.
In summary, this's the procedure of my solution
- Step 1: To identify what feature/web-part falling out (Feature-ID and Web-Part Class-ID)
Get-SPSolution <SolutionName>
- Step 2: If it turns out that it’s to do with the feature, then disable the feature with ‘-force’ switch, then verify that by:
stsadm -o displaysolution -name SOLUTION-NAME
- Step 3: If it’s to do with web-part we have no longer used, then delete the related pages permanently.
Once we done all that, we could simply use my script to verify on the SQL Server level:
SELECT distinct Webs.FullUrl, Webs.Title, AllDocs.DirName, AllDocs.LeafName
FROM AllDocs, Sites, AllWebParts, Webs
WHERE Webs.Id = Sites.RootWebId
AND AllDocs.Id = AllWebParts.tp_PageUrlID
AND Sites.Id = AllDocs.SiteId
AND tp_WebPartTypeId IN (
SELECT DISTINCT tp_WebPartTypeId FROM AllWebParts (NOLOCK)
WHERE tp_WebPartTypeId = 'WebPartClassId')
If no result-set appears from the SQL query, it means that all related pages have been removed completely from the SharePoint (wait, not 100%, it might still appear from Search simply because Search using different database and caching modules). - Step 4: “iisreset -noforce”, then check the “Health Analyzer” for verifications.
What an quick-win tip! Hopefully, it will help anyone who has this similar issue later on.