Run stsadm command preupgradcheck
If this tool mentions some possible upgrade blocking issues, continue with cleanup the server farm.
Run stsadm command enumallwebs. This command has different parameters:
stsadm.exe -o enumallwebs [ -databasename <database name>] [ -databaseserver <database server name>] [ -includefeatures ] [ -includesetupfiles ] [ -includewebparts ] [ -includeeventreceivers ] [ -includecustomlistview ]
Clean up missing webparts
Includewebparts lists all webparts belonging to a Site/Web. Additional information to the webparts is ID, Type, Count and the status. The status is important for clean up. If the status is set to Missing, the webpart is corrupt or not installed. In order to get the specific location of this webpart, use this select statement in the affected database:
SELECT [DirName],[LeafName] FROM [databasename].[dbo].[AllDocs] LEFT JOIN [databasename].[dbo].WebParts ON [databasename].[dbo].[AllDocs].Id = [databasename].[dbo].WebParts.tp_PageUrlID WHERE [databasename].[dbo].WebParts.tp_WebPartTypeId = 'FeatureID'
Replace databasename with the name of the affected database and FeatureID with the given ID of the tool.
The result of the select statement is the url of the page which contains the webpart and the page name itself. Visit the page, find the corrupt webpart and delete it. Frequently, the corrupt webpart is closed, so it is not visible on the page but in the “closed webpart” section.
Clean up missing features
Includefeatures lists all features registered for a Site/Web and additional information to the features like Id, Name and InstallPath. If the status is set to “Missing”, the feature is not installed. In order to avoid such messages, there are the two opportunities:
- Deactivate the feature via ststadm:
stsadm -o deactivatefeature -id IdOfFeature -force
Use the force parameter also.
- If this does not help, you can delete the reference in the database (NOT SUPPORTED BY MICROSOFT)
Run the select statement in the content DB which includes the affected web:
SELECT * FROM [NameOfContentDB].[dbo].[Features] WHERE FeatureId = 'IdOfFeature'
Please make sure, that the result is your feature you are missing. If you are sure, delete the database entry:
Delete FROM [NameOfContentDB].[dbo].[Features] WHERE FeatureId = 'IdOfFeature'
Clean up missing setup files
Includesetupfiles lists all setup files belonging to a Site/Web and their information. Search for the status “Missing”. In order to get the location of the missing file, use the select statement in the affected content database:
SELECT DirName, LeafName FROM [NameOfContentDB].[dbo].[AllDocs] WHERE LeafName = 'NameOfFile'
NameOfFile is not the path but only the last part of the path.
If you get the location, you can go to the location within the SharePoint site or run SharePoint Designer. Delete the file. Examples are webparts, aspx files or pictures.
Make sure that the files are deleted in the recycle bins also.