Monthly Archives: July 2010

Troubleshooting SharePoint 2010 content database upgrade issues

The upgrade process from SharePoint 2007 to 2010 is relatively straightforward and painless… unless you encounter a problem during the upgrade process.

In most cases, the Test-SpContentDatabase cmdlet will notify you early in the process of potential gotchas and traps.  In addition, the Test-SpContentDatabase cmdlet even provides a verbose level of feedback and recommendations when issues are encountered.  Pretty sweet SharePoint team!

But, what happens when you receive an error while executing the
Mount-SpContentDatabase command.  Say, something like this:

Mount-SPContentDatabase : Action 4.0.32.0 of Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence failed.
At Line:1 char:24
+ Mount-SPContentDatabase <<<< –Name “My DB Name” –WebApplication “My URL”
+ CategoryInfo : InvalidData: (Microsoft.Share…ContentDatabase: SPCmdletMountContentDatabase) [Mount-SPContentDatabase], SPUpgradeException
+ FullyQualifiedErrorID : Microsoft.SharePOint.PowerShell.SPCmdletMountContentDatabase

While appearing very verbose, this error is not helpful and rather intimidating.

Now what?

 

Log files, that’s what!

The upgrade process within SharePoint 2010 produces very verbose (and helpful) log files during the upgrade.  These logs are located at

C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14Logs

Find the log file ending with “-error” and review the contents for more details on what occurred during the actual upgrade.  In the case of the error above, the following information was logged

[powershell] [SPContentDatabaseSequence] [ERROR] [7/11/2010 6:26:57 PM]: Exception: Cannot find the object "dbo.AuditData" because it does not exist or you do not have permissions.

Now we have something we can dig into and research!

Root cause for our failure

In this case, the content database was originally upgraded from SharePoint 2003 to SharePoint 2007.  Somewhere in the migration process (and the intervening years), the dbo.AuditData table never got created.

To correct, we simply scripted the dbo.AuditData table from a existing (and functioning) SharePoint 2010 content database and executed those scripts against the failed content database.

 

Hopefully, your upgrade and migration issues are as easy to fix!

Migrate a content database from SharePoint 2007 to 2010

SharePoint 2010 support two methods for migrating and upgrading a SharePoint 2007 install

[EDIT: Upgrading to SharePoint 2013?  Check out our post at http://blog.armgasys.com/?p=275]

Method#1
In place upgrade.
This is very simple and straightforward.  You insert the SharePoint 2010 DVD, run the “is everything ready for an upgrade” wizard, and then perform the upgrade.  You just have to remember all things SharePoint 2010 are now 64bit.

Method#2
Migrate and upgrade individual web applications and content database.
This is known as the Database Attach Method of upgrading and is (based on my experience) the most common upgrade SharePoint users will encounter.

In this post, we will be reviewing the steps for performing method #2 upgrades.

Step#0 – Backup everything related to the content database you are migrating
Nuf’ said!

Step#1 – Attach the SharePoint 2007 content database to the new database server
This step only applies if you are also migrating to a new database server during the SharePoint 2010 upgrade process.  If you are not changing database servers, skip to step#2

For SQL Server 2005 users, see the following MSDN article
http://msdn.microsoft.com/en-us/library/ms190209(SQL.90).aspx

For SQL Server 2008 users, see the following MSDN article
http://technet.microsoft.com/en-us/library/ms190209.aspx

Step#2 – Create a new web application in SharePoint 2010
To upgrade a content database, you must first have a SharePoint web application created which will connect to and consume the soon to be upgraded content database.

  1. Launch the SharePoint 2010 Central Administration web site
  2. Select Manage Web Applications  under Application Management
  3. Click “New” on the ribbon
  4. Configure the new web application to fit your needs
    NOTE: Take the defaults for Database Name.  See Step#3 for more details.

Step#3 – Delete the content database which was just created in Step#2
Yes, you read correctly, delete the content database.

  1. Launch the SharePoint 2010 Central Administration web site
  2. Select Manage Content Databases under Application Management
  3. Select the web application created in step#2 from the web application drop down loaded in the upper right of the screen
  4. Click on the Database Name which was created in step#2
    It will be named something like WSS_Content 1234ab-cfe1234-443abc-1234ab
  5. Scroll to the bottom of the database information page displayed and check the Remove Content Database checkbox
  6. Click the OK button

What is happening here?
SharePoint requires a target web application for ALL content databases. Why? Because the web application determines which features are supported and installed for all content hosted by that web application.  When the actual migration process occurs, the upgrade software scans the content database for all of the features being used by the content (I.E. lists, document repositories, third party, web parts, etc) and then determines if the target web application supports that feature.

The problem we encounter is that SharePoint has nicely created an empty content database which we are never going to use because we already HAVE a content database.  So, we need to perform a little bit of cleanup work.

Step#4 – Validate the SharePoint 2007 content database can be upgraded
SharePoint contains a PowerShell cmdlet which will validate the content database against the web application created in Step#3.

  1. Launch SharePoint Powershell
    Start –> All Programs –> Microsoft SharePoint 2010 Products –> Management Shell
  2. At the prompt, type the following PowerShell command
      Test-SPContentDatabase –Name “Database Name” –WebApplication [url]Example
    Test-SPContentDatabase –Name “Content DB” –WebApplication http://test.site.com
    Will test the content database named Content DB against the existing web application http://test.site.com
  3. Review the output for any issues listed as Upgrade Blocked: Yes
    Any issue listed as Upgrade Blocked will need to be corrected.

Step#5 – Mount the database onto the web application created in Step#3
This step will upgrade and mount the database against your newly created web application

  1. Launch SharePoint Powershell
    Start –> All Programs –> Microsoft SharePoint 2010 Products –> Management Shell
  2. At the prompt, type the following PowerShell command
    Mount-SPContentDatabase –Name “Database Name” –WebApplication [url]

 

And that is all there is to it.
Happy migrations!

Remembering SharePoint 2010 Powershell Commands and cmdlets

I was in the process of migrating a SharePoint 2007 content database to SharePoint 2010 using the attach database upgrade method when my brain stop functioning.  I could not remember the appropriate Powershell command to attach the new database.  All I could remember was the command was part of the SPContentDatabase series of cmdlets.

Enter the venerable HELP command.

By entering the command

help *spContentDatabase

I received the following output:

image

In short, I was able to get a full list of all spContentDatabase cmdlets.  Yes boys and girls, the help system supports wild cards.  Powerful indeed!