Monday, January 6, 2014

Migrating a Single Sub-Site from a MOSS 2007 Farm to an existing SharePoint 2010 Farm

I was recently tasked to migrate a single sub-site from a degraded MOSS 2007 farm to an existing SharePoint 2010 farm.  The existing MOSS 2007 sub-site is contained within a single content database, in a single site collection with over 2500 other sub-sites.  The task was to migrate just the one single sub-site, so here are the steps I took to accomplish this move, using the Database Attach method.

  1. Create a new content database in the MOSS 2007 farm.  This was accomplished through SharePoint 3.0 central Administration.  It's a pretty straight-forward process.  I did this so I had a clean database to move that only had the data I needed.
  2. Create a new site collection in the new content database within MOSS 2007.  Again, a straight-forward process using SharePoint 3.0 Central Administration.  I mimicked the managed path that I wanted to use in the SharePoint 2010 environment.
  3. Open Command Prompt and change directory to %COMMONPROGRAMFILES%\Microsoft shared\web server extensions\12\bin, then run the following STSADM command to export the content of the site:
    stsadm -o export -url <Old Site URL> -filename <export file name.cab> -includeusersecurity -versions 4 (to include all versions)
    More information about stsadm export/import can be found HERE
    It's important to make sure you have enough available disk space for the backup files.  You can verify the size of the site by opening it up in SharePoint Designer (2007 in this case) and clicking Site > Reports > Site Summary

    If you get an error during the export process (Error: Unknown compression type in a cabinet folder), it means you have insufficient disk space available.  Please keep in mind that it will write temp files to the C drive, so make sure you have at least 2-3x the total storage needed, or save the back up files to a different drive to split off the load.

  4. Once the content has been exported, use the following STSADM command to import the content of the site to the new site collection on the new content database:
    stsadm -o import -url <New Site URL> -filename <export file name.cab> -includeusersecurity

At this point, we have isolated just the content we need into a new MOSS 2007 content database, which will make the move much easier than it was before we started.  If you run into any problems with the above steps, make sure the account you are using has the necessary permissions.  

Before we create a backup of the 2007 content database and move it to the new 2010 farm, we will need to run the Pre Upgrade Check and fix any issues reported before moving on to the next step:
stsadm -o preupgradecheck

Once the database is ready, it's time to create a backup the database and copy it over to the new SQL instance:
  1. Open Microsoft SQL Server Management Studio for the 2007 instance. 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.
After the database is in the new environment, restore, test and mount the database to SharePoint 2010:
  1. Restore the SharePoint 2007 backup to SharePoint 2010 SQL Server. Open Microsoft SQL Server Management Studio. Right-click on Databases and select Restore Database...
  2. Enter the new database name, making sure that you don't overwrite the original content database. Select the Source and click OK to start.  If the database is showing "offline", be sure to bring it online before moving to the next step.
  3. Next, test the database against the existing SharePoint 2010 web application.  If there are any errors, make sure to correct them before mounting the SP2007 content database.
    Test-SPContentDatabase -Name <DatabaseName> -WebApplication <URL>
  4. If there are no errors (or the errors have been fixed), use the Mount-SPContentDatabase cmdlet. This cmdlet also upgrades the SP2007 content to SP2010.
    Mount-SPContentDatabase <ContentDb> -WebApplication http://SiteName
    If the database was moved from a different environment, you may need to change the site collection administrators in order to see the Site Settings menu
  5. Verifiy the data is moved properly and perform visual upgrade.

No comments:

Post a Comment