Wednesday, January 6, 2010

Upgrade SharePoint 2007 Content DB to SharePoint 2010

Before we get into the Content Database attach method there are a few prerequisites to consider to make sure your upgrade is successful.

Install any custom features, web parts, solutions, custom site definitions, and any custom CSS files. Don’t forget to configure Alternate Access Mappings, include paths, templates, and outgoing email settings. (Future post)

Make sure you create a new web application in your SP 2010 environment, this is needed to do this type of upgrade. If you get a error content database already exists go into central administration –> Application Management –> Manage Content Databases –> click database then delete it (screenshot below).

image

Start up SharePoint 2010 Management Shell (PowerShell leave it running well be back later). Write the results to a file, enter the following command:

“Test-SPContentDatabase –Name <database name> –WebApplication <URL> | out-file “<file path\file name.txt>”

Your output file should look like this below. We have to fix any of the errors that are “UpgradeBlocking” other errors can be addressed at a later time. Fix as may of these as possible before moving on.

image

Backup your current SP 2007 content database:

2007_contentDB

Restore database selecting your source and destination:

image

Make sure you click Options and select Overwrite the existing database:

image

NOTE: You may get a SQL error.

 image

You can get around this by scripting the restore database (drop down menu top of Restore Database window) to a new query window and adding “ALTER DATABASE  <Database Name> SET SINGLE_USER WITH ROLLBACK IMMEDIATE” to the top of your query. This will put the database into single user mode and kill any other connections that could be locking the database.

Go back to SharePoint 2010 Management Shell and add the content database to the web application using:

“stsadm –o addcontentdb –url <URL> –databasename <database name>”

This will force the upgrade procedure on the content database:

image

More to follow….