Backing up and restoring SharePoint 2010 databases, content, and configurations can be a complex endeavor. Microsoft has made some significant improvements to the native tools, including the addition of features that let administrators back up an entire farm configuration, an individual web application, an individual site collection, or even specific content. In addition, administrators can now connect to unattached content databases and restore content from them. With that said, it isn’t immediately obvious which backup and restore tools are best for which situations and how to use them. So, I’ll first shed some light on the available backup and restore tools, then concentrate on the tools with which administrators should be familiar.
Knowing Your Options
There is a wide array of options to back up a SharePoint environment:
- SQL Server tools. SharePoint content that’s stored in SQL Server databases can be backed up using SQL Server’s built-in backup and restore tools. You can initiate the backup as a one-time task or as a scheduled job. SharePoint database backups can be combined with other SharePoint backups, such as those available through SharePoint’s Central Administration site or the SharePoint 2010 Management Shell. Unlike SharePoint restore procedures, SQL Server restore procedures can’t restore item-level objects. Only complete database restores are possible.
- Central Administration tools. The Central Administration site includes several tools that can be used to backup and restore the SharePoint environment. However, not all backup and restore options are available when using the Central Administration tools.
- SharePoint 2010 Management Shell. SharePoint 2010 introduces the SharePoint 2010 Management Shell, which is built on top of Windows PowerShell. By executing SharePoint-specific PowerShell commands in the SharePoint 2010 Management Shell, administrators can gain some functionality that isn’t available through the Central Administration tools.
- Recycle Bin. Originally introduced in the SharePoint 2007 wave of products, this tool is used by users and administrators. Data can be restored by users within 30 days of deletion and thereafter by site collection administrators. SharePoint 2010 SP1 added the Site Recycle Bin, which lets site collection administrators restore entire sites that have been deleted.
- AppCmd. Using the AppCmd command-line tool, administrators can back up the Internet Information Services (IIS) 7.0 configuration file on a Windows Server 2008 machine. The IIS 7.0 configuration file consists of web.config and applicationHost.config files. When a system failure occurs, administrators can restore the IIS 7.0 configuration from the backup file.
- Stsadm. Although available in SharePoint 2010, Stsadm has been deprecated and is provided only to support backward compatibility. PowerShell is the preferred option—and in certain situations, the only option—for managing the SharePoint 2010 environment.
- Microsoft System Center Data Protection Manager (DPM) 2010. DPM 2010 is Microsoft’s enterprise backup tool. It does snapshot-level backup and restore of SharePoint content, providing for full-farm or item-level recovery. DPM is a separate component that isn’t included with SharePoint 2010.
- Third-party backup tools. Multiple vendors have backup tools for SharePoint 2010 that offer advanced functionality, such as item-level restores.
By using the SQL Server backup and restore tools and SharePoint 2010 Management Shell in addition to the backup and restore options in Central Administration, you can be fully prepared in the event of outages and other problems. The SQL Server tools and SharePoint 2010 Management Shell give SharePoint administrators more backup and restore options—particularly those related to restoring SharePoint databases, performing incremental backups, and scheduling—that aren’t available when using the Central Administration tools. So, let’s take a closer look at these three tool sets.
Using the SQL Server Tools
Fully loaded, a SharePoint 2010 environment will have about 25 databases that contain a significant amount of crucial content. (By fully loaded I mean deployed with FAST Search Server 2010 for SharePoint; Microsoft Office Web Apps; all service applications; and content, logging, and configuration databases.) That’s a huge number of databases to maintain and back up. To minimize the potential for lost content, it’s crucial to have a solid database backup plan.
There are many options available to back up and restore SharePoint databases. In addition to the Central Administration tools and SharePoint 2010 Management Shell, other options include using SQL Server Management Studio (SSMS) or T-SQL scripts. You can also use a third-party database backup tool.
No matter which tool you use, it’s important to understand that when you back up the databases, the search index and any web server customizations aren’t backed up. So, database backups generally aren’t the only backup option chosen by most administrators.
SQL Server offers many different types of database backups, including:
- Full backup. The entire database (including the transaction log) is backed up.
- Differential backup. All the data changes since the last full backup are recorded.
- Transaction log backup. All transactions performed against the database since the last full backup or the last transaction log backup are backed up.
- File and file group. A portion of the database is backed up.
- Partial backup. All data in the primary group, every read-write file group, and any specified files are backed up. File groups marked as read-only are skipped.
- Differential partial backup. Although similar to the partial backup, this backup only records changes to the data in the file groups since the previous partial backup.
- Copy-only backup. Unlike the other types of backups, a copy-only backup isn’t recorded in the database and isn’t used for restoration. Any type of backup (e.g., full, differential, partial) can be a copy-only backup.
Here’s an example of how to use SSMS to perform a full backup:
- Open SSMS.
- In the Connect to Server dialog box, select the name of the database server you want to connect to and click Connect.
- In the left pane of Object Explorer, expand the Server folder, then the Database folder.
- Select the SharePoint database you want to back up.
- Right-click the database, select Tasks, then click Back Up.
- In the General page of the Back Up Database window shown in Figure 1, confirm the name of the database to be backed up and confirm that the Backup type option is set to Full.
- Set the Backup component option to Database.
- In the Backup set section, enter the name and description for the database backup.
- In the Destination section, select Disk or Tape. (The Tape option will be grayed out if there are no tape devices attached to the database server.) You can back up information to as many as 64 disk devices or tape devices. If multiple devices are specified, the backup information will be spread across those devices. All the devices must be present to back up the database. If you need to add a device, click Add, enter the requested information, and click OK to return to the Back Up Database window.
- Click Options in the Select a page pane to configure advanced backup options. (Alternatively, you can click OK to initiate the backup if you don’t want to configure any advanced backup options.)
- In the Options page’s Overwrite media section, you can choose to add the backup to an existing media set or new media set. If you want to add the backup to the existing media set, you have the option of appending it to the existing backup set or overwriting all existing backup sets. For this example, maintain the default settings of Back up to the existing media set and Append to the existing backup set.
- In the Options page’s Reliability section, leave the Verify backup when finished option selected. Microsoft recommends that you leave it selected so that your database backup is verified. However, the verification process extends the time it takes to complete the database backup.
- In the Options page’s Reliability section, select Perform checksum before writing to media. This option ensures that the database backup is completed without any errors. However, the checksum process extends the time it takes to complete the database backup.
- In the Options page’s Reliability section, select Continue on error. This option ensures that the database backup will continue even if an error is encountered. However, selecting this option will have an impact on the performance of the server because it increases CPU overhead.
- Click OK to execute the backup.
- Review the backup operation’s success or failure error messages and click OK to finalize.
- Repeat steps 2 through 16 for any additional SharePoint databases.
Using the Central Administration Tools
The most obvious choice to back up SharePoint configurations and components is to use the built-in tools in the Central Administration site. The site’s Backup and Restore page comes with two options: Farm Backup and Restore and Granular Backup. Using the Farm Backup and Restore option, administrators can back up and restore a complete farm, a farm’s configuration, or individual components in a farm. New to SharePoint 2010, you can use the Granular Backup option to back up a site collection, export a document library or list, and recover data from an unattached content database.
As with previous versions, scheduling backups via the Central Administration site isn’t an option. However, you can perform a one-time backup. For example, to back up a farm configuration, you need to perform the following steps:
- Open the Central Administration site on a SharePoint server. Select All Programs on the Start menu, click Microsoft SharePoint 2010 Products, and choose SharePoint 2010 Central Administration.
- Select Backup and Restore in the Quick Launch toolbar.
- Select the Perform a backup option in the Farm Backup and Restore section.
- In the Select Component to Back Up page, select the Farm component and click Next.
- In the Select Backup Options page shown in Figure 2, select Full in the Backup Type section.
- In the Data to back up section on the same page, select Back up only configuration settings.
- In the Backup location text box on the same page, enter a backup location.
- Click Start Backup.
After starting the backup, SharePoint 2010 displays the Backup and Restore Job Status page. It might take several minutes for the backup process to appear on the page, depending on the backup type and the data being backed up. It might be necessary to refresh the screen occasionally to see the updated status. You can also monitor the backup progress by clicking the View History link, which shows the historical backup progress rather than the current status.
You can view the backup files in the location you selected in step 7. You’ll find an XML manifest and files with .bak extensions. The XML manifest is required for a restore, so don’t delete it.
Restoring content is more difficult than backing up content. Fortunately, restoring content is fairly straightforward with the Central Administration tools. For example, here are the steps to take to restore a farm:
- Create a new farm to which to apply the restore if it doesn’t already exist.
- Open the Central Administration site on a SharePoint server.
- Select Backup and Restore in the Quick Launch toolbar.
- Select the Restore from a backup option in the Farm Backup and Restore section.
- In the Backup and Restore History page, enter where your backup files are located in the Backup Directory Location text box.
- In the Top Component column, select the farm that you want to restore and click Next.
- It will take a few minutes before the Select Component to Restore page appears. On this page, select the farm components you want to restore and click Next.
- In the Select Restore Options page, select either the New configuration option or the Same configuration option. Choose the New configuration option if you want to restore the data to a farm with a different configuration, in which case it’ll have different computer names, web application names, and database server names. Choose the Same configuration option if you want to restore the data to the same farm, in which it’ll have the same computer names, web application names, and database server names.
- Click Start Restore to commence the restore process.
Using the SharePoint 2010 Management Shell
The SharePoint 2010 Management Shell makes it easy to automate backup and restore processes. All the backup and restore options in the Central Administration site can be initiated in the SharePoint 2010 Management Shell. For example, to back up a farm configuration, you’d execute the following PowerShell command from the SharePoint 2010 Management Shell:
backup-spfarm -BackupMethod Full -Directory C:\Backup\ -ConfigurationOnly
(Although this command wraps here, you'd enter it all on one line in the SharePoint 2010 Management Shell. The same holds true for the following command that wraps.) To back up a single web application, you’d execute this command:
backup-spfarm -BackupMethod Full -Directory C:\Backup\ -Item http://webapplicationname
Besides automating backup and restore processes, administrators can schedule their backups—something not possible with the Central Administration tools. For more information about using PowerShell for SharePoint backup and recovery, see the “Backup and recovery cmdlets (SharePoint Foundation 2010)” web page.
Developing a Backup Strategy
The wide array of tools to back up SharePoint content, configurations, and components can be quite daunting. However, you can develop a backup strategy that has the correct mix of tools based on your business requirements. A good place to start is to use the SQL Server tools and SharePoint 2010 Management Shell along with the backup and restore options in Central Administration. With these tools, you can effectively back up your SharePoint environment and restore it if needed, without any loss to your business.