Upgrading your Content Database to SharePoint 2010 – Database Attach method

Posted by on Dec 16, 2009 in SharePoint, SharePoint 2007, SharePoint 2010

Welcome back to the second article in this series on upgrading a SharePoint 2007 content database to SharePoint 2010.  In part 1 we deep dived into the preupgrade tool that Microsoft made available with SharePoint 2007 SP2 and today we will complete our upgrade journey utilising one of the 3 upgrade models that are available to you by Microsoft.  These are listed as follows;

  1. In-place upgrade
  2. Database attach upgrade to a new farm
  3. Hybrid approach (Read –only databases or Detach databases)

There is a wealth of information regarding these different approaches on the Microsoft TechNet site under the Upgrade and Migration Resource Center for SharePoint 2010. I will also outline other resources at the end of this article for convenience.

The upgrade model that I have chosen in this article series is the Database attach upgrade approach in which I will outline in this step by step guide.  The upgrade choice you choose is dependent on a number of factors such as how much down time can you afford and whether you are moving onto newer hardware.  All three options have their strong and weak points which is outlined in the following TechNet article; Determine Upgrade approach (SharePoint 2010)

This article is assuming that your SharePoint 2010 environment is up and running (albeit in beta form).  I have published a 3 part series in getting your SharePoint 2010 environment up and running that you can access from the following links;

  1. Installing SharePoint 2010 Beta on a Windows 2008 R2 Server
  2. Configuring SharePoint 2010 (Beta) Service Applications and User Profile Service Synchronization
  3. Creating your first SharePoint 2010 Beta Web Application and Site Collection

When using the database attach method to upgrade your databases to SharePoint 2010, you need to be aware that none of your configuration settings in SharePoint 2007 will migrate.  You will need to ensure that you have replicated your 2007 environment in the newly created 2010 farm.  Some of the items to consider include the following;

  • Outgoing email server
  • Alternate Access Mappings (AAM)
  • Quota templates
  • Included paths
  • Install any custom or 3rd party features, including web parts, solutions
  • Custom site definitions
  • Custom CSS

In order for you to perform a database attach upgrade into your SharePoint 2010 environment you need to ensure that you have created a new web application.  If you have not done so, you can follow my step by step guide on Creating your first SharePoint 2010 Beta Web Application and Site Collection.

Step 1 :: Restoring a copy of your SharePoint 2007 content database

Now that we have ensured that all our configuration settings are in place, and that all custom features, web parts and solutions have been re-instated, we can now proceed with our upgrade.  You will need to firstly backup and take a copy of your SharePoint 2007 content database and restore it to the newly created SharePoint 2010 farm.

I’m performing my database restore utilising SQL 2008 Management Console.  Right click on Databases and select Restore Database.

Select your source and destination as follows;


Click on Options and ensure you have selected Overwrite the existing database.


Click OK.

We should receive the following confirmation message once the database has been successfully restored.


Step 2 :: Verifying the Content Database

As you have already noticed from our first article, in particular with the introduction of the preupgrade check tool, Microsoft have done a great job in providing us with the necessary tools to ensure a successful upgrade.  The next tool that we will be using is the Test-SPContentDatabase Windows PowerShell cmdlet.  This cmdlet will test and verify that any custom components that are required for this content database has been installed and configured in the SharePoint 2010 environment.

Test-SPContentDatabase –Name <database name> -WebApplication <URL>
Launch the SharePoint 2010 Management Shell and type the above command, ensuring you have entered your Database Name and URL. e.g. below
Test-SPContentDatabase –Name WSS_Content_Intranet -WebApplication http://intranet.georgekhalil.com
The Test-SPContentDatabase is a great reporting tool that will list any missing setup files, web parts and provide you with information on how to remedy any errors.  It will also specify whether these missing features will block the upgrade from succeeding.
You can either attend to these missing features pre or post-upgrade but this depends on whether there are any items that will block the upgrade from proceeding.  Once you have remedied the above, we can proceed with our next tool, which will add the content database to our Web Application.  The stsadm  addcontenddb command line parameter is as follows;
stsadm -o addcontentdb -url <URL> -databasename <database name>
Before proceeding, ensure that there are currently no databases connected to the web application that we will be attaching to.  You can check this via Central Administration / Application Management / Manage content databases.

If one is listed, you can remove the existing attached database by clicking on the actual database name and then clicking on the “Remove content database” check box.


You will receive the above warning which is safe to ignore.  In this instance we are not deleting the actual database but disassociating it from the selected Web Application.  This is the exact same behaviour that was available to us in SharePoint 2007.

We can now proceed and attach our restored SharePoint 2007 database via the following stsadm command line;

stsadm -o addcontentdb -url <URL> -databasename <database name>

In my instance, the command looked as follows;

stsadm -o addcontentdb -url http://intranet.georgekhalil.com -databasename WSS_Content_Intranet
This will initiate the upgrade process as per the below screen capture.


You will eventually receive a message similar to the below advising that the upgrade was completed albeit with errors in my case.  You should review the upgrade log file which is quite extensive and lengthy, and sure enough the errors were all related to missing features etc which I was already aware of.


We can now verify that the upgrade was completed successfully by first navigating back to Central Administration / Application Management / Manage content databases, which now displays the upgraded database under my designated Web Application.


We can also view the upgrade status page which is located within Central Administration / Upgrade and Migration / Check upgrade status.  The page will list all previous upgrade attempts and summarise the number of errors and warnings that may have been encountered.  In my case, there were a number of features that were not installed in the new SharePoint 2010 farm that the current portal relies on.  All of the upgrade logs are located in the following location, providing you with finer detail on the errors and warnings encountered;

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS


By default, your site will retain it’s 2007 theme which Microsoft have done on purpose and you will need to manually change this 2010 if you wish to do so.  This is referred to as the “Visual Upgrade”, providing site administrators the ability to switch to the new look and feel at their own leisure.  This is a great move by the SharePoint product team as the new interface can be quite overwhelming to begin with.  Think about the move from Office 2003-2007 with the introduction of the new ribbon interface.   There was a week or two of frustration for most users before eventually getting the hang of it and finding the new interface to be more productive.

The below screen capture is my upgraded SharePoint 2010 portal running in “SharePoint 2007 theme mode”.


To perform the Visual upgrade, navigate to Site Actions / Visual Upgrade.



Here you are provided with 3 options in which I will select “Use the new SharePoint user interface, and don’t ask me again”.  After clicking on OK, I am now presented with the same site utilising the default SharePoint 2010 theme.


We have now successfully upgraded one of our SharePoint 2010 content databases housing our main Intranet portal, albeit with some missing web parts and features.  So what’s next on the agenda?  Upgrading My Sites of course!  This will involve attaching and upgrading your Shared Service Provider (SSP) to upgrade your user profile information followed by upgrading the My Sites content database.  This process will be left for a future post.

I hope you have found this 2 part series useful and I am interested hear how many of you have attempted a SharePoint 2010 upgrade and your experiences.

Subscribe to this blog and join our Facebook page and Twitter Page to keep up to date and be notified of our latest articles.

If you require any assistance with your SharePoint or other IT needs, the team at GKM2 are happy to assist.  You can contact us via info@gkm2.com.au or 1300 797 288 within Australia.

Resources from TechNet

Determine Upgrade approach (SharePoint 2010)

Microsoft SharePoint 2010 Products Upgrade Approaches – Diagrams

Upgrading to SharePoint Server 2010

Preparing to upgrade to SharePoint 2010 Products

Attach databases and upgrade to SharePoint Server 2010


Articles in this series

  1. Upgrading your Content DB to SharePoint 2010 – Part 1, The preupgradecheck
  2. Upgrading your Content DB to SharePoint 2010 – Part 2, Database Attach method


  1. thank you for this valuable blog

    but when switch to SharePoint 2010 visual upgrade give me the following error

    Visual Upgrade failed. The default master page for this user interface could not be found at “/_catalogs/masterpage/v4.master”. Add the requested master page at this path and try again.

  2. Were you able to figure this out? I’m having the same problem

  3. when one does the database attach approach – via say stsadm -o addcontentdb – what happens when the content database contains the SP 2007 root site collection? One would, I presume, already exist on the SP 2010, and I doubt seriously that one would want to overwrite it with the old SP 2007 one. However, the SP 2007 one would have sites, lists, etc. that contained critical information.


  1. SharePoint 2010 scripted install with powershell part 5 - [...] Database attach mode: http://sharepointgeorge.com/2009/upgrading-content-database-sharepoint-2010-database-attach-method/ [...]