SharePoint 2010 Granular Backup-Restore Part 1

Hello! Russ Maxwell here and I’d like to provide a glimpse into SharePoint 2010 granular backup/restore. Several things have changed and have been improved in this area. This article is specifically themed around granular backup\restore and what you need to know.

Key Concepts:

Granular Backup: Granular backup has been placed into its own section within Central Administrator. This includes multiple options including the following options:

· Perform a site collection backup

· Export a site or list

· Recover data from an unattached content database

clip_image002

Basics

In SharePoint 2007, all granular backup and restore operations were only available using stsadm. SharePoint 2010 has integrated granular backup restore operations into both Central Administrator and PowerShell. Some backward compatibility does exist with stsadm but PowerShell is the new and improved replacement. Stsadm will be left out of this blog. Part 1 of this blog will include all granular backup/restore options except for “Recover data from an unattached content database”. Part 2 of this series will be dedicated to that topic. Performing backup operations deemed as granular can be performed from Central Administrator or PowerShell. Granular restore operations are only available using PowerShell. SharePoint 2010 is more flexible in terms of what can be backed up and restored. It’s possible to backup and restore site collection, sites, lists, document libraries, and items. The options for performing granular backups using Central Administrator are:

· Perform a site collection backup

· Export a site or list

· Recover data from an unattached content database (Covered in Part 2 of this series)

 

Granular backup operations

Backing up a Site Collection

You can backup a specific site collection using either Central Administrator or Powershell.

Using Central Administrator

  1. Select Backup and Restore
  2. From the UI select Perform a site collection backup
  3. Select the appropriate site collection from the pull down menu
  4. Include proper UNC path including backup file named like: filename.bak
  5. Selecting Start backup redirects to _admin/sitebackuporexportstatus.aspx page.

Using Powershell

backup-spsite -identity https://contosoweb -path \\server\backupshare\bufile.bak

 

Backing up a Site, Library, or List

Exporting a Site/sub-site

Export a specific site using Central Administrator:

1. Select Backup and Restore
2. From the UI select Export a site or list
3. Select Site Collection\Site "leave list drop down clear"
4. Optional categories is to export full security or export versioning history
5. Selecting Start export redirects to _admin/sitebackuporexportstatus.aspx page.

Using Powershell

export-spweb -identity https://contosoweb -path \\servershare\bu\site.cmp

Export a specific list or library:

1. Select Backup and Restore
2. From the UI select Export a site or list
3. Select Site Collection\Site
4. Select a list
5. Optional categories “export full security or export versioning history”
6. Selecting Start export redirects to _admin/sitebackuporexportstatus.aspx page.

Using Powershell

export-spweb -identity https://contosoweb -path \\servershare\bu\hrpowershell.cmp -itemurl /cake

Note: This example demonstrates exporting a document library named cake from Contosoweb site.

 

Granular restore operations

Granular restore operations require the use of Powershell as no UI in Central Administrator exists. Two cmdlets are available for granular restore operations.

restore-spsite

This cmdlet is used to restore site collections that have been backed up using “Perform a Site Collection Backup” in central administrator or backed up using backup-spsite cmdlet.

For Example: restore-spsite -identity https://contosoweb -path \\server\backupshare\backupfile.bak

You have plenty of parameters available but the example demonstrates the required parameters. To get the full scope of parameters you can run:

get-command restore-spsite -syntax

What you should know about using restore-spsite

The identity/URL parameter shouldn't point to a site collection that is present. If the intention is to overwrite an existing site collection, you must use the -force parameter.

import-spweb

This cmdlet is used to restore sites, list, and libraries exported with “export site or list” option in central administrator or using export-spweb cmdlet.

For Example: import-spweb -identity https://contosoweb/ -path \\appserver\bu\list.cmp

Note: You can’t decipher if a list or library is being imported into the contosoweb site using import-spweb. This has been predefined in the backup prior to running import-spweb.

 

What you should know about using import-spweb

Sites and subsites: Importing a site/subsite works as long as you specify a URL with a site that contains a matching template. For Example, importing a team site to https://contosoweb requires that I first provision a site using the team site template using URL https://contosoweb. Attempting to import to a site using a blank template or different template will result in an error.

List and Libraries: It’s important to determine exactly what items you want to import into a list or document library. If no items exist, then running the command in the example above will suffice and all items will be imported. What if a user accidently deletes 5 items out of 1,000 and you simply want to restore those 5 items? By default, the import-spweb cmdlet overwrites items if they exist with the restored version. In this case, the item version prior to restore can be salvaged by restoring the previous version as long as versioning is enabled. To prevent a scenario where you want items which currently exists to be ignored by import operation, you must include the -updateversions parameter with ignore

So in this example, to restore 5 items without affecting the 995 items which currently reside in a list named odst I can run the following:

Import-spweb –identity https://contosoweb/ -path \\appserver\bu\odst.cmp -updateversion ignore

Note: New Items created within the ODST library after initial export will not be touched by an import operation.

 

Check Granular backup job status

A sleek new page has been added to check on granular job back status. Two ways to get to this page is through Central Administrator and after initiating a granular backup automatically redirects you to the _admin/sitebackuporexportstatus.aspx page.

clip_image004

Stay tuned for Part 2 of this series which I’ll discuss how SharePoint 2010 leverages snapshots using the Recover data from an unattached database option.

 

-Russ Maxwell, MSFT