SharePoint 2010 Cookbook: How to Migrate a SharePoint 2007 Site to SharePoint 2010 Using Database Attach

Change is never easy! Whether it’s going to college, getting married, or just getting the new, cool haircut you’ve always wanted, there will be something that you’ll miss not having (freedom of the single life, anyone?). Moving to SharePoint 2010 is no exception. Although upgrading is rewarding, with improvements in many areas, you will still need the precious content that exists in your current SharePoint 2007 environment. In this article, I’ll demonstrate how to migrate a site to SharePoint 2010 using the database attach method.


How can I migrate just the site/site collection I want from SharePoint 2007 to SharePoint 2010?

Moving the entire farm to SharePoint 2010 could take a lot of time, bordering on seeming like forever. Sometimes, however, we just want to get the contents of a specific site/site collection up and running on the new platform as soon as possible.


Using the database attach method, we can migrate a site/site collection to SharePoint 2010 following these basic steps:

Step 1: Move the needed site to a new Web application.
Step 2: Copy the content database backup to the SharePoint 2010 SQL server.
Step 3: Mount that content database to the SharePoint 2010 server.

Notes before migrating

  • Always backup your content database just to be on the safe side.
  • The SharePoint 2007 server must have SharePoint Service Pack 2 installed.
  • Run the upgrade check program on your SharePoint 2007 server, stsadm -o preupgradecheck. Fix any issues reported before moving on to the next step.


Step 1: Move the site to a new web application in SharePoint 2007

Let’s say we want to migrate the SharePoint site at http://duyfarm/TeamSite.

  1. First, create a new Web application and blank site collection (for example: http://duyfarm:6789).
  2. Login to the SharePoint server using an account that has the following rights/permissions:
    • SharePoint Farm Admin.
    • Local Administration rights on the Web server.
    • db_owner permission on the content databases.
    • Make sure the access account has access to the site content (sometimes farm admin might not be a site collection admin).
  3. Open Command Prompt and change directory to %COMMONPROGRAMFILES%Microsoft sharedweb server extensions12bin, then run the following STSADM commands:
  4. stsadm -o export -url <URL name> -filename <export file name> -includeusersecurity

    stsadm -o import -filename <import file name> -url <URL name> -includeusersecurity


The imported Web application might look like this:



Step 2: Copy the content database backup to the SharePoint 2010 SQL server

  1. Open Microsoft SQL Server Management Studio. Right-click on the content database and select Tasks > Backup…
  2. Enter the Backup Name, select Destination, and click OK to start.
  3. Copy this backup file to the SharePoint 2010 SQL server.


Step 3: Mount the content database to the SharePoint 2010 server

  1. On the SharePoint 2010 server, create a new empty Web application. For example: http://duyfarm2010:6789.
  2. If you have any custom components on the original site, install them to this Web application now.
  3. After that, we can restore the SharePoint 2007 backup to SharePoint 2010 SQL Server. Open Microsoft SQL Server Management Studio. Right-click on Databases and select Restore Database…
  4. Enter the new database name, making sure that you don’t overwrite the original content database. Select the Source and click OK to start.
  5. Open SharePoint 2010 Management Shell and dismount the current SP2010 content database.
    Dismount-SPContentDatabase <ContentdBName>
  6. Verify that we have all the needed custom components. If there are any errors, make sure you correct them before mounting the SP2007 content database.
    Test-SPContentDatabase -Name <DatabaseName> -WebApplication <URL>
  7. My test shows no error, so we are ready to run the Mount-SPContentDatabase cmdlet. This cmdlet also upgrades the SP2007 content to SP2010.
    Mount-SPContentDatabase <ContentDb> -WebApplication http://SiteName
  8. After this process has completed, you need to review the log files (the upgraded log file and error log file) to make sure there are no errors. The log files are located at %COMMONPROGRAMFILES%Microsoft Sharedweb server extensions14LOGS. The logs are named in the following format: Upgrade-YYYYMMDD-HHMMSS-SSS-error.log and Upgrade-YYYYMMDD-HHMMSS-SSS.log, where YYYYMMDD is the date and HHMMSS-SSS is the time (hours in 24-hour clock format, minutes, seconds, and milliseconds). If there are errors at this time, they will most likely be due to some customization done on the SharePoint 2007 server.


We have finally finished the migration process. Notice that after our upgrade is completed, the new site looks exactly like it was in SharePoint 2007. In SharePoint 2010, there is a feature called Visual Upgrade that gives you an option to switch between SharePoint 2007 look and feel or the SharePoint 2010 view.  Note that if you have customized themes on the old site, you must re-create the new theme on the new site before you can switch.  To switch over to the new SharePoint 2010 look, do this:          

  • Login as Site Owner and select Site Actions > Visual Upgrade.

  • Select Update the user interface. Click OK.


 Here is the SharePoint 2010 look and feel:



See Also:

re: SharePoint 2010 Cookbook: How to Migrate a SharePoint 2007 Site to SharePoint 2010 Using Database Attach
on Wed, Nov 16 2011 6:25 PM

This is a great article, but do I do have a question regarding this:

By adding more databases to your Sharepoint 2010 installation for every site you migrated and add from Sharepoint 2007….does this not cause issues with global searching within Sharepoint 2010 since there are not multiple databases?


re: SharePoint 2010 Cookbook: How to Migrate a SharePoint 2007 Site to SharePoint 2010 Using Database Attach
on Wed, Dec 14 2011 7:20 AM

When I restore the database, and create a new Web Application, do I have to create a blank site? I tried to create a blank site and it didn’t work. And, when I made the same steps (without creating any site) the site don’t open. Appears: HTTP/1.1 200 OK Connection: close.

Could give a little help?


Blog de los hermanos Marchena Sekli – Tecnología Microsoft, música y mucho mas!
Migrando sites de SharePoint 2007 a SharePoint 2010
on Wed, May 9 2012 8:34 PM

Debido a la gran acogida que ha tenido la nueva versión de SharePoint “SharePoint 2010”

re: SharePoint 2010 Cookbook: How to Migrate a SharePoint 2007 Site to SharePoint 2010 Using Database Attach
on Mon, Oct 15 2012 8:41 AM

Hi there,

Thank you for the great article!!

I just want to know can I follow the same processes that you described here when I want to go from SharePoint 2007 (using SQL Server 2008) to SharePoint 2010 (using SQL Server 2012)?  Or must I do the SharePoint migration and upgrade the SQL database?

Thank you,


SharePoint Online

The cloud parts are functional components that extend your SharePoint Online environment in Microsoft 365.

Supports Classic and Modern sites for SharePoint Online/Microsoft 365


Top SharePoint Online Products

Experience greater power and savings by bundling our SharePoint apps and cloud parts.

Calendar Plus

Chart Plus

Knowledge Base

Project Management Central

Simple List Search


On-Premises Only

These web parts extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of SharePoint Web Parts.

SharePoint 2013, 2016, 2019 – Classic Pages Only


Top On-Premises Only Products

Experience greater power and savings by bundling our SharePoint apps and web parts.

Calendar Plus

Data Viewer

Password Change

Password Expiration

Password Reset


Our team of Microsoft 365 experts help you get the most out of your Microsoft technology, we have the best Microsoft 365 talent to streamline your organization.

Streamline Your Department

We Have What You Need

Bamboo Solutions



Webinar & Events


Culture & Diversity



Bamboo Solutions



Bamboo Installer


Featured Services

SharePoint Health Check

A SharePoint Health Check will identify the causes of issues and risks associated with your specific environment, and is custom tailored to provide you with the best recommendations to optimize your SharePoint environment.

SQL Health Check

Document recommendations relating to performance, stability, availability, or a specific focus you request of your SQL Server database instances.

My SharePointXperts

The truth is that each SharePoint skill may not be a full time job for many organizations, and it is nearly impossible for one person to do everything you need – so augment your team with SharePointXperts; providing the skill sets you need when you need them!