次の方法で共有


Mount-SPContentDatabase failing on Blank Meeting Workspace

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:

  1. Backup your SharePoint 2007 Content Database
  2. Open the SharePoint 2010 Management Shell
  3. Run:  Mount-SPContentDatabase
  4. Hit enter, then fill in the name of the database and the web app you want to attach the database to
  5. Upgrade completes successfully, the world is a happy place
  6. Leave the PowerShell window open

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.

  1. Detach the content database from the SharePoint 2010 web application
  2. Delete the database from SQL Server
  3. Restore the backup
  4. In the existing PowerShell window, run Mount-SPContentDatabase again
  5. Upgrade fails  :-(

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_content
CanUpgrade [SPSite Url=https://jormanweb05/sites/blog] failed.
SPContentDatabase Name=wss_content
Exception: 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.

Comments

  • Anonymous
    June 15, 2010
    Hi, this solved my problem, I closed and opened Powershell and the upgrade worked then, thanks a lot for posting this.

  • Anonymous
    February 17, 2012
    Thanks for finding this random issue.  Bug is still not addressed in SP1 with December 2011 CU.

  • Anonymous
    February 26, 2012
    Oh my word! This was driving me insane!  Thank you!

  • Anonymous
    September 17, 2012
    The comment has been removed

  • Anonymous
    January 18, 2013
    Yep, same problem here.   I had the PowerShell window open for a week.  The upgrade logs don't make it look like a PowerShell issue.  Was there another specific event or log that pointed you in that direction, or was it just trial and error?

  • Anonymous
    June 12, 2013
    The comment has been removed