Sharepoint 2010: Can I use restore-spsite on a .bak file from backup-spfarm

backupsharepointsharepoint-2010

I'm looking at implementing a backup plan for our new Sharepoint 2010 server. From what I understand, there's several new powershell commands available in 2010: backup-spfarm, restore-spfarm, backup-spsite, restore-spsite.

Now for a daily job, backup-spfarm seems reasonable to use. However I'm concerned that running this alone may not be granular enough for restores. What happens if a single site collection needs restoring (perhaps someone deleted something they shouldn't have)?

I want to be able to restore a single Site collection without affecting all the other site collections if need be.

What's best practice here? Should I run backup-spfarm, and then backup-spsite on all my site collections as well? Or does backup-spfarm supersede backup-spsite?

Best Answer

You can't really easily do a targeted restore of a site collection from a backup made with Backup-SPFarm, unless that site collection is in its own content database. If the site collection is the only resident of its content database, then you should be able to target the content database with the -ITEM parameter for Restore-SPFarm, but that's as granular as those CMDLETs go.

If you want to target an individual site collection lives in a content database with more than one site collection in it, you're going to have to consider one of the following options:

  • do the targeted Backup-SPSite like you mentioned
  • use SQL Server backups, restore the backup as a new database in your instance then join it to your farm as an unattached DB and do a granular restore from that unattached DB
  • restore the farm backup content database to a different farm, then do a Backup-SPSite of the target site collection and restore that backup to your production farm.

The other thing you can look at is the Site Recycle Bin that was added in SharePoint 2010 SP1, that will capture site collections and webs that were accidentally deleted.

John