Avoid running Mount-SPContentDatabase using the same database name in a single PowerShell window. You'll likely only run into this if you are doing some upgrade testing, but it was driving me insane today, so wanted to share:
Scenario:
You start messing with some customized sites and end up breaking one after doing the visual upgrade. You want to start over with a clean upgrade on the database.
You check out the upgrade file in the \14\Logs folder and there are some errors stating that upgrade did not occur on your site collections. At first, the only errors seemed related to the Basic Meeting Workspace site:
[powershell] [SPWebTemplateSequence] [ERROR]: Template MPS#0: SPWeb Id=f1c7b33e-ccf1-4c6c-b0ac-947d678a693a could not be accessed in SPSite Id=d587100d-220e-4732-8bff-ab765f377806 due to exception. Skipping this SPWeb for template upgrade. Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.SPSite.PreinitializeServer(SPRequest request) at Microsoft.SharePoint.SPSite.GetSPRequest() at Microsoft.SharePoint.SPSite.get_Request() at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId, Int32 mondoHint) at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ActivateWebFeatures(List`1 lstwebinfoToUpgrade, List`1& lstsiteidExceptions, List`1& lstwebinfoExceptions)
I did some further testing and created a site collection using each of the templates and reproduced again. This time I noticed all the site collections were failing to upgrade. All of them failing with a NullReferenceException. The Blank Meeting Workspace [MPS#0] was failing with the above stack, but the others were more subtle:
SPContentDatabase Name=wss_contentCanUpgrade [SPSite Url=http://jormanweb05/sites/blog] failed.SPContentDatabase Name=wss_contentException: Object reference not set to an instance of an object.
Note: Removed the date/time and extra info from the log entry.
After a bit of troubleshooting, I found that as long as I open a new PowerShell window to run Mount-SPContentDatabase, the upgrade was consistently working.
Hi, this solved my problem, I closed and opened Powershell and the upgrade worked then, thanks a lot for posting this.
Thanks for finding this random issue. Bug is still not addressed in SP1 with December 2011 CU.
Oh my word! This was driving me insane! Thank you!