I wanted to take a minute and talk about a really cool new feature of SharePoint 2010 relating to backups – Granular Restores.  While doing some test migrations from MOSS 2007 to SharePoint 2010, we needed to choose the best method to selectively move data from an old site to a new site. 

In SharePoint 2010, you have the ability to restore content (down to the list level) from an unattached SQL database.  How cool is that!  Here’s the new Backup and Restore options in Central Admin:

SharePoint 2010 Granular Restores

Performing a granular restore has 2 main steps:

  1. Exporting the site or list from the content db (you’re really pulling out only the data you want to restore) which writes the data out to a .cmp file.
  2. There is no UI for the actual restore, so you must use the Import-SPWeb command to restore the .cmp data file to your site destination.

Let’s look at a couple situations on how this might work. 

Scenario 1

You’re already running SharePoint 2010, and you’re recovering data from a backup.  You have restored an existing 2010 database in SQL to another name and is online, but it is not attached to a SharePoint web application.  How do I get my data?

  1. In Central Admin, click Backup & Restore, then choose Recover data from an unattached content database.
  2. You specify the SQL server name and the content database you restored, and specify what you want to do (browse, backup site collection, or export the data).  You can just browse the content in the database.  Cool!  In our case, we want to restore the data, so choose Export site or list.

SharePoint 2010 Granular Restore Operations

  1. Pick the site collection, site and/or list you want to restore.  Specify a filename (local or UNC) with .cmp, if you want all of security information, and what versions of the content you want, and click Export.  It looks like this:

SharePoint 2010 Export

  1. Using Powershell, restore the .cmp.  Use the command:

 

Import-spweb -identity http://intranet.contoso.com/projects -path c:\backups\sharedocuments.cmp

That’s it!  Now, what if you wanted to move data from one site to another that was online but on different networks?  Well then you could skip down to step 3 and run your export, then powershell to restore the data.  What if the data came from WSS 3.0 or MOSS 2007 as part of an upgrade?  Well there are a couple more steps for that.

Scenario 2

You are upgrading to SharePoint 2010, but as part of a phased migration.  The content in your existing site is very disorganized, and you want to stand up pieces as you go.  This prevents you from performing an in-upgrade upgrade (I wouldn’t recommend anyway), or a db-attached method for the whole site collection.  You’re doing a more hybrid approach.  We will perform the same steps as above, however we need to get the content database upgraded to 2010 format.  How do we do that?  First we’ll assume you’ve already built a new SharePoint 2010 farm on new shiny hardware, created your service applications, and a web application. 

NOTE: This is not a blog on upgrades.  Be sure to meet prereqs for upgrades, like installing SP2 and running stsadm preupgradecheck.  You need to be sure you have no upgrade blocking missing features.

  1. Lock your existing v3 site (either through stsadm or CA) and make a copy of your content database in SQL.  Then restore it into a new database, and make sure its online.  Reset the lock to none.
  2. Now we need to get the database to 2010 format.  If you tried right now to run a restore from an unattached content database, you will get a nicely worded (for a change) error message stating its in a lower format.  SharePoint is smart enough to know that if you mount a v3 database and attach it to a 2010 web application, it checks the format and it will upgrade it for you.  Sweet!  To get it going, run the following powershell:

 Mount-SPContentDatabase -name wss_content_2007 -webapplication http://sp2010webapp

 This mounts the database and attaches it to the web application http://sp2010webapp.  While it runs, it will show you a progress in percent complete that it is upgrading.  If the upgrade fails at this time, you can run the Upgrade-SPContentDatabase PS command to retry.

  1. Once complete, you can verify its attached by going into Central Admin, Application Management, Databases, Manage content databases.  It will probably show errors, that can be normal if you have features missing between your old site and new.

You have a couple options here.  You can browse to the site and see what it looks like, and copy data out that way.  Or, you can detach it from the web application (Dismount-SPContentDatabase in PS) and run the restore from unattached content database, then export it and restore it.  Up to you.