Overview of Backing Up and Restoring Data in SharePoint Foundation

Applies to: SharePoint Foundation 2010

This topic provides some basic facts about how to back up and restore data in Microsoft SharePoint Foundation.

What Can Be Backed Up and What Can Be Restored

There are several types of content components built into SharePoint Foundation that can be backed up and restored by one or more of the following facilities. Which facilities are available varies with the type of component.

  • The Central Administration application user interface (UI)

  • The stsadm.exe command-line tool

  • A Windows PowerShell cmdlet that is included with the SharePoint Management Shell.

  • Code that uses the SharePoint Foundation backup and restore object model in a custom application, custom stsadm operation, or custom Windows PowerShell cmdlet.

Table 1: Available Backup Facilities By Component Type

Component

Backup and Restoration Support with Central Administration UI, Stsadm Operation, or Windows PowerShell cmdlet

Backup and Restoration Support with Custom Code

Specific field in a list item

No restoration support, and cannot be backed up separately from a backup of the parent content database.

Individual restoration is possible by using the unattached database object model, but cannot be backed up separately from a backup of the parent content database.

List item

No restoration support, and cannot be backed up separately from a backup of the parent content database.

Individual restoration is possible by using the unattached database object model, but cannot be backed up separately from a backup of the parent content database.

List

Individual restoration is supported, but cannot be backed up separately from a backup of the parent content database.

Individual restoration is possible using the unattached database object model, but cannot be backed up separately from a backup of the parent content database.

Web site

Individual restoration is supported, but cannot be backed up separately from a backup of the parent content database.

Individual restoration is possible using the unattached database object model, but cannot be backed up separately from a backup of the parent content database.

Site collection

Yes

Yes, by using SPSiteCollection.Backup and Restore().

Content database

Yes

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup).

Web application

Yes

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup).

Content publishing Web service*

Yes

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup).

Search Windows service including its databases and indexes**

Yes

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup).

Web services implementing the Service Application Framework and their associated service application proxies

Yes

Yes, by using either the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup) or the supplemental Backup/Restore object model provided by the framework.

IIS application pools used by Web services implementing the Service Application Framework

Yes

Yes, by using the supplemental Backup/Restore object model that is provided by the Service Application Framework

A whole SharePoint Foundation farm

Yes, but the topology and server names of the restoration target must match those of the backup source farm (or else there is some post-restore work required to reconfigure content and services).

Yes, by using the main Backup/Restore object model object model (Microsoft.SharePoint.Administration.Backup), but the topology and server names of the restoration target must match those of the backup source farm (or else there is some post-restore work required to reconfigure content and services).

Configuration settings for the farm and Content publishing Web services*

Yes

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup).

Custom content component

Yes, as long as the component implements IBackupRestore.

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup) and IBackupRestore.

Custom configuration settings

Yes, as long as the component implements IBackupRestoreConfiguration.

Yes, by using the main Backup/Restore object model (Microsoft.SharePoint.Administration.Backup) and IBackupRestoreConfiguration

Note

*This refers to content publishing "Web services" (which are really partitions of content) that are represented in the object model by SPWebService objects. It does not refer to the functional Web services in the more common sense of "Web service," such as the Alerts (websvcAlerts) service or the Meetings (websvcMeetings) service. For more information about content publishing "Web services," see Server and Site Architecture: Object Model Overview and Administrative Object Model of Microsoft SharePoint Foundation.

**This does not refer to the Search Web service websvcSPSearch.

Limitations

There are some limitations on what data can be backed up and restored. These limitations include:

  • You cannot back up the configuration database of a SharePoint Foundation server farm or the content database of the Central Administration application separately from backing up the whole farm. However, you can back up and restore the configuration settings of the farm and of any content publishing Web services.

  • You cannot restore the configuration database of a server farm or the content database of the Central Administration application. (The backups of these components that are included in a backup of a farm provide a snapshot of these components at the time of the backup. Such snapshots can be useful for troubleshooting because they can be used to compare with the present state of the components by using SQL Server tools.) But restoring a farm, including its complete configuration database and the content database of the Central Administration application, is not a flexible option because with that option server names and topology information for the restoration target farm must be identical to the corresponding data for the source farm. We recommend that, after SharePoint Foundation has been installed to a target farm, farm administrators restore the configuration settings and then restore Web applications and other content as needed. If you do this, the configuration settings function as a kind of ‘farm template’ that does not presuppose any particular farm topology.

  • You cannot back up the Internet Information Services (IIS) configuration store (which primarily consists of the applicationhost.config file).

  • You cannot back up an IIS application pool, with the exception of application pools that host Web services which implement the Service Application Framework.

The following kinds of content cannot be backed up by using the Central Administration application's UI, the stsadm command prompt utility, or any of the Windows PowerShell cmdlets that are included with SharePoint Foundation; however, you can create custom backup solutions with the Microsoft SharePoint 2010 Software Development Kit (SDK) that include these kinds of content.

  • Registry keys.

  • Files that live on front-end Web servers; that is, outside of any content database, such as certain master pages, ascx files, web.config files, and other configuration files.

    Note

    Configuration changes made to the web.config file by means of the SPWebConfigModification class are backed up.

Finally, as indicated in Table 1, you cannot restore an individual list item by using the Central Administration application UI, the Stsadm command-prompt utility, or any cmdlets that are included with SharePoint Foundation. But you can create a custom solution with the unattached database object model to restore specific list items.

Types of Backups and Restorations

Backups of a specified component can be either full or differential. In the latter case, only parts of the component that have changed since the last full backup are backed up.

Note

A SharePoint Foundation search index cannot be incrementally backed up. If a search index is included in a differential backup job, the index will get a full backup.

Restorations can either overwrite the original backup source or they can be to a new location. This means that the backup and restore functionality in SharePoint Foundation can also be used as a method of migrating content components.

Note

For more information about how to migrate Web sites, lists, and other content types that are smaller than a site collection, see Content Migration.

Four Kinds of Custom Backup/Restore Applications

There are four ways to use the SharePoint Foundation object model to create custom backup/restore applications.

1: Main Backup and Restore Object Model

You can create a backup and restore application by using the main backup and restore object model. This is located mainly in the Microsoft.SharePoint.Administration.Backup namespace; but backups and restores of individual site collections are performed with the SPSiteCollection.Backup and SPSiteCollection.Restore methods. For more information about how to use the main backup and restore object model, see Programming with the SharePoint Foundation Backup/Restore Object Model.

2: Interface to the Volume Shadow Copy Service

SharePoint Foundation deployments can also take advantage of the Volume Shadow Copy Service (VSS) in Windows Server 2008. SharePoint Foundation includes a SharePoint 2010 VSS Writer service that will create shadow copies of native and custom content in the deployment. The service contains a VSS writer that will write shadow copies of all native SharePoint Foundation databases and all custom databases. Non-database custom components can also be registered with the service by using the SPVssComponentDefinition and SPVssDiscoveryHelper classes. It is also necessary that you create a VSS writer for any such non-database custom components. For more information about how to program SharePoint Foundation's interface to the VSS, see SharePoint Foundation and the Volume Shadow Copy Service.

Note

With the VSS service, you can target only the whole farm or individual content databases for database shadow copy. Individual Web applications and individual content publishing "Web services" cannot be set for shadow copying independently of making a shadow copy of the whole farm. (For information about the meaning of "content publishing Web service" see the notes at the bottom of Table 1.)

3: Database Snapshot Management

SharePoint Foundation has a built-in timer service job that creates and deletes database snapshots, as long as the SharePoint Foundation databases are hosted by either the Enterprise or Developer editions of Microsoft SQL Server. A custom application can configure such settings as the frequency of snapshot creations and the lifespan of snapshots. It is also possible to replace the built-in timer service job with a custom job. Finally, a custom content database can be programmatically configured to be restorable from a snapshot. For more information about the programmability of database snapshot management, see Programmatic Administration of Database Snapshots and How to: Create a Database Class That Can Be Restored From a Snapshot.

4: Unattached Database Restoration

An unattached database is a database that is not registered in the farm configuration database. However, it can be used as a source for restoring or importing data to a farm. Usually, the unattached database is a backup copy of a content database; but it can also be a VSS shadow copy (that has been mounted in Microsoft SQL Server) or a database snapshot. Data units as big as a complete content database or as small as a single list can be restored from an unattached database in the Central Administration UI or with an stsadm operation. Custom applications can also create unattached database objects and move data from them to a content database. A custom application can restore data as discrete as a single list item. For more information about the programmability of unattached databases, see Fine-grained Data Restoration from Unattached Database.

See Also

Concepts

Fine-grained Data Restoration from Unattached Database

Programmatic Administration of Database Snapshots

Programming with the SharePoint Foundation Backup/Restore Object Model

SharePoint Foundation and the Volume Shadow Copy Service

Other Resources

Content Migration

stsadm.exe command-line tool