“Database is up to date, but some sites are not completely upgraded” – and the journey to straighten things out
I faced an interesting thing in the SharePoint environments of one of my customers the other day…obviously the cool stuff never happens on your local environments .
This customer had patched their environment lately, everything was running smooth, nobody was complaining about anything, then, by incident, I checked the databasestatus.aspx page in central admin and found some databases marked with:
“Database is up to date, but some sites are not completely upgraded”.
So my first idea was, because they had a awful lot of databases in this state, to loop through all the databases and perform an upgrade-spcontentdatabase on the ones which contain not upgraded sites.
After running the script I found nothing changed on the UI (turns out if you do an IIS reset or an AppPool recycle this changes quite quickly). So after doing an IIS reset on the CA box I found some databases in the desired state “No action required” others though still in the same state.
So I checked the upgradestatus.aspx in the CA and found some warnings and errors for the databases containing sites which are not upgraded in the referenced upgrade logs. The most warnings I saw stated that
“Feature could not be upgraded. Exception: Unable to access web scoped feature (id: FeatureID) because it references a non-existent or broken web (id: webID) on site “siteurl”. Exception: System.ArgumentException: Value does not fall within the exptected range.”
When I checked the mentioned site and searched for the specific web I found this web existing in the recycle bin of the site.
So my next step was to create a PowerShell script to loop through all the sites and figure out which sites contain web objects in their recycle bin.
Once I have done that I created another PowerShell script removing all the webs from the recycle bin of the affected sites.
After that I ran my upgrade script again and found all databases in the “No action required” state except for two.
The first one was easy, this database was taken offline and for that couldn’t be upgraded.
For the second one I found Errors in the upgrade logs telling me:
Exception: Attempted to perform an unauthorized operation.
at Microsoft.SharePoint.SPSite.set_AllowDesigner(Boolean value)
at Microsoft.SharePoint.Portal.Upgrade.AllowMasterPageEditingAction.Upgrade(SPSite site)
This confused me because I knew that my customer had SharePoint Designer disabled for this webapplication.
After some asking around it turned out this wasn’t always the case, they had it enabled for a short timeframe… So my assumption is one of their sitecollection administrators must have enabled SharePoint Designer on his or her site during that short timeframe and maybe even modified something with it… scary huh?
Now SharePoint Designer being disabled on webapplication level SharePoint seems to have a little problem with that when performing upgrade operations on this site.
To overcome this issue I enabled SharePoint Designer for the webapplication and rerun my upgrade script again and afterwards disabled the SharePoint Designer settings again on the webapp level. After that I had all databases in every SharePoint Admins favorite state “No action required”