This post provides some basic facts about backing up and restoring data in Windows SharePoint Services 3.0. It will serve as background information for several developer-oriented posts that I will create in the next couple of weeks.
Note: Unless explicitly stated otherwise, all classes and members referenced in this post are in the Microsoft.SharePoint.Administration.Backup namespace.
What Can Be Backed Up and What Can Be Restored
There are six types of content components built-in to Windows SharePoint Services 3.0 that can be backed up and restored through either the Central Administration application’s UI, the Stsadm.exe Command-line Tool or a custom application that uses the Windows SharePoint Services 3.0 backup and restore object model.
· Site collections, each of which might contain multiple Web sites.
· Content databases, each of which might contain multiple site collections.
· Web applications, each of which might contain multiple content databases.
· Content publishing “Web services,” each of which might contain multiple Web applications.
Note: This refers to content publishing “Web services” (which are really partitions of content) that are represented in the object model by Microsoft.SharePoint.Administration.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 The High Level Object Model of Windows SharePoint Sevices 3.0 (to be published on MSDN).
· Search Windows service including its databases and indexes.
Note: This does not refer to the Search Web service websvcSPSearch.
· A whole Windows SharePoint Services farm.
If an enhanced functionality product such as Office SharePoint Server 2007 has been installed in addition to Windows SharePoint Services 3.0 and that product includes Shared Service Providers, then they can also be backed up and restored with Windows SharePoint Services 3.0.
In addition, you can create new types of content objects that can be backed up and restored by implementing the IBackupRestore interface.
There are some limitations on what can be backed up and restored through either the Central Administration application’s UI, the stsadm command line utility or a custom application that uses the Windows SharePoint Services 3.0 backup and restore object model.
· You cannot backup (or restore) an individual Web site, list, or list item except by backing up (or restoring) the entire site collection to which it belongs.
· You cannot back up a Windows SharePoint Services farm’s configuration database or the content database of the Central Administration application except by backing up the whole farm.
· You cannot restore a farm’s configuration database 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 might be useful for troubleshooting because they can be used to compare with the present state of the components using SQL Server tools. (There is an exception to this point: you can restore the configuration database and the content database of the Central Administration application if you are using the Volume Shadow Copy Service – VSS – of Windows Server 2003/2008).
· You cannot back up the Internet Information Server (IIS) metabase.
The following kinds of content cannot be backed up with either the Central Administration application’s UI or the stsadm command line utility, but you can create custom backup solutions with the Windows SharePoint Services SDK that include these types of content.
· Registry keys.
· Files that live on the front-end servers; that is, outside any content database, such as certain master pages, .ascx files, web.config files, and other configuration files.
Types of Backups and Restorations
Backups of a given component can be either full or incremental. In the latter case, only parts of the component that have changed since the last full backup are backed up.
Note: A Windows SharePoint Services Search index cannot be incrementally backed up. If a search index is included in an incremental 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 Windows SharePoint Services 3.0 can also be used as a method of migrating content components.
Two Kinds of Custom Backup Applications
There are two ways to use the Windows SharePoint Services object model to create custom backup applications.
The Main Backup and Restore Object Model
You can create a backup and restore application by using the main backup and restore object model, sometimes called “catastrophic” backup/restore. This is located mainly in the Microsoft.SharePoint.Administration.Backup namespace; but backups and restores of individual site collections are performed with the Microsoft.SharePoint.Administration.SPSiteCollection.Backup() and Microsoft.SharePoint.Administration.SPSiteCollection.Restore() methods.
Interface to the Volume Shadow Copy Service
Windows SharePoint Services 3.0 deployments can also take advantage of the Volume Shadow Copy Service (VSS) in Windows Server 2003/2008. Windows SharePoint Services 3.0 includes a Windows SharePoint Services 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 Windows SharePoint Services 3.0 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.
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 first note of this post.)