Backup and Restore in SharePoint 2010
By: Arshad Ali | Updated: 2010-10-21 | Comments | Related: > Sharepoint
So what are the 'out of the box' Backup and Restore options available in SharePoint 2010? How do we backup the SharePoint farm, web applications and different components? How have Backup and Restore processes have improved from previous versions of SharePoint to SharePoint 2010?
As a SharePoint Administrator, you need to set up a backup plan so that you can restore your SharePoint farm or SharePoint web applications without any hassles if a disaster happens or even to create a replica of your production environment for QA and development purposes.
Backup and restore functionalities in SharePoint 2010 have matured tremendously from previous versions. Now you can backup and restore farms as well as web applications from the Central Administration more easily. You can even take granular backups. For example, you can take a backup of any specific site collection from the Central Administration. You can export site content to the file system and import it into another site.
And yes. now you don't need to setup another temporary farm to just restore some content from the backup, you can simply restore a content database on any SQL Server instance and then use the unattached content database recovery feature from Central Administration to restore the selected content.
This tip discusses the Backup and Restore of a SharePoint farm, web applications and components from the Central Administration as well as from PowerShell and the STSADM command.
Backing-up SharePoint farm from the Central Administration
Go to START -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Central Administration.
On the left side, click on the Central Administration link and in right side, in the detail pane, you will see Backup and Restore options as shown below.
You can also directly click on the Backup and Restore link in the left side to go to Backup and Restore page as shown next.
On the Backup and Restore page, you can see two sections, Farm Backup and Restore which allows you to take backup of SharePoint farm and web applications and also restore them when required. You can even see the status of any running backup and restore operations and also view the history of any backups taken so far on the specified location. (I will be talking about Granular Backup in more detail in a future tip).
Click on the Perform a backup link under Farm Backup and Restore to start the backup operation. You need to make sure SharePoint 2010 Timer (used to send notifications and perform scheduled tasks for SharePoint) and SharePoint 2010 Administration (used to perform administrative tasks for SharePoint) windows services are running or else you will not be able to perform backup and restore operations.
On the first step, you can select either to backup a whole farm or an individual web applications or components from it. In this example we will take a backup of a whole SharePoint farm. After selecting "Farm" we see all the components within it by default get selected.
On the second step, you can re-define the components you are going to take a backup of. Next you need to define backup types. i.e. full backup or differential backup (which you can take only if you have taken at least one full backup beforehand). A differential backup combines the changes which happened since the last full backup. If your content database is not that huge, it is recommended to setup for full backup only which would be easier during a restoration. If you have a very large database, then you can combine these two backup types for reduced backup time and less storage. With restoration, you need to restore the latest full backup first followed by the latest differential backup.
By default both configuration settings and content databases are backed up as part of backup operation, though if required you can choose to backup only the farm configuration. And finally you need to specify a backup location where a folder will be created and backed up components will be stored. On the bottom section of the next screen you can see the estimated disk space required for the selected backup type.
Click on the Start Backup button to create a timer service job which will run in the background and take this backup. As I said before you need to have both the SharePoint 2010 Timer and SharePoint 2010 Administration windows services are running.
On the Backup and Restore Job Status page, you can monitor the status of your backup or restore job (pictured below). In this case, 43 items have been backed up out of total 192. This page gets refreshed every 30 seconds to reflect current information but you can also refresh it by clicking on Refresh link.
The Default Backup and Restore Settings page allows you to specify the number of threads which will be used during a backup operation and the number of threads which will be used during a restore operation. By default it is 3 threads -- if the number of threads were higher, performance would be higher but it would consume more resources. Also going through the logs generated by these higher number of threads would be a little difficult.
Next you can specify the default backup location, each timer job will create a new sub folder and store the content within it.
Backing-up web-application(s) from the Central Administration
The process of taking backup of web-applications is not much different from taking backup of the entire farm. In the first step while selecting components to backup, instead of selecting farm, you need to select individual web applications or components for which you want to take backup of.
As you had options while taking a backup of the farm, these options are available here as well. You can choose the component if you need to do so and you can specify whether you want to take full back or differential backup and then you can specify the location where you want backup to be stored.
On the Backup and Restore Job Status page you can see and monitor the status of your backup or restore operations.
Restoring SharePoint farm/web application(s) from the Central Administration
To restore a SharePoint farm and web applications, go to Backup and Restore page as shown below. Click on the Restore from a backup link to go to restore page.
On the first step of restore, specify the shared location where you have stored the backup and click on the Refresh button. It will display a list of all the backups available on the specified location. Choose the backup that you want to restore and click on the Next button. As with backup, you need to ensure both the SharePoint 2010 Timer and SharePoint 2010 Administration windows services are running.
On the second step of the restore, all the components that the selected backup contains will be displayed as shown below. You can decide which of the components you want to restore from the selected backup. For example you can see below I have selected to restore the AdventureWorks web application.
On the third and final step of the restore, you can re-purpose your selection of components to restore. Next you need to specify that the restore will use the same configuration, web application name, database server name, database name or you want to ignore the existing configuration and use a new configuration for the restore. This gives you flexibility if you are restoring the same backup to a different environment.
On the Backup and Restore Job Status page, you can monitor the restore operation progress. Though the restore status page gets refreshed in every 30 seconds, you can click on Refresh link to refresh the status of the restore operation on-demand. As I said above, by default SharePoint uses 3 restore threads during restore operation which you can see below. You can change this default settings by going to Default Backup and Restore settings page.
Backing-up farm or web-application(s) using PowerShell and STSADM tool
Central Administration is not the only way to do backup and restore in SharePoint 2010. SharePoint 2010 provides several PowerShell cmdlets to perform these operations, in other words you can script these operations and schedule it with Windows Task Scheduler to make it run on scheduled basis.
The Backup-SPFarm command is used to backup the entire farm, web applications or a farm's components or farm configuration, etc. The general syntax of this command is:
Backup-SPFarm -Directory <BackupFolder> -BackupMethod [Full | Differential] -Item <components to be backed up> [-Verbose]
To launch the SharePoint 2010 PowerShell console, go to START -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Management Shell and click on it. To take a backup of an entire farm, we need to use the Backup-SPFarm command and specify the location where a backup will be stored and the type of backup we want to take (shown below). A verbose parameter gives details about the status during backup:
Backup-SPFarm -Directory \\MKTARALIW2K8R2\SharePointBackupFolder -BackupMethod Full -verbose
To backup any individual content database or web application, use the Item parameter (as shown below). The rest other parameters remain same:
Backup-SPFarm -Directory \\MKTARALIW2K8R2\SharePointBackupFolder -Item "Farm\Microsoft SharePoint Foundation Web Application\AdventureWorks" -BackupMethod Full -verbose
Restoring a farm or web-application(s) using PowerShell and STSADM tool
To restore an entire farm use the Restore-SPFarm command and specify the location where backup is stored, restore method to overwrite existing deployment or whether restoring afresh on new environment:
Restore-SPFarm -Directory \\MKTARALIW2K8R2\SharePointBackupFolder -RestoreMethod Overwrite
You can specify a specific component to restore from the existing farm backup using the Item parameter, for example I am restoring only the AdventureWorks web application from the available farm backup as shown below:
Restore-SPFarm -Directory \\MKTARALIW2K8R2\SharePointBackupFolder -Item "Farm\Microsoft SharePoint Foundation Web Application\AdventureWorks" -RestoreMethod Overwrite
STSADM is an administrative tool which has been in previous versions of SharePoint for all the administrative tasks and still supported (though enhanced in some ways) in SharePoint 2010. However, STSADM has been deprecated as well. Instead of using this tool, its recommended to use PowerShell cmdlets. For that reason I will not be talking about it in details.
- Please note though you can still use the old STSADM tool to perform backup and restore but it is recommended not to use this tool (unless you are forced to use it for backward compatibility) as this tool has been deprecated and provided in SharePoint 2010 only for backward compatibility.
- The spbrtoc.xml file on the backup/restore location keeps the backup and restore history. The spbackup.xml file in the backup/restore folder keeps the status about each component involved in the operation. In case of any error you can refer to Spbackup.log file in the specified location for more detail.
- When you take a farm backup, certificates are not backed up with it so you need to plan for its backup separately. Likewise if you use forms-based authentication you need to ensure you take backup of manually updated web.config separately (if the web.config gets updated by Central Administration, there is no need for this additional step).
- To improve the performance of Backup and Restore operations, make sure you use the local path location to minimize the latency and then move the file to network share if required. For example, if you have both SharePoint site and SQL Server on the same machine, use a local path. If not then use a network shared location which can be accessed quickly (probably keeping the shared location on the SQL box or keeping it on fast drives).
- Only a member of the Farm Administrators group can take a backup using Central Administration. Also you need to have Full Control on the shared given to the SQL Server service's account, SharePoint 2010 Timer Service and Central Administration's application pool identity account.
- Additional related PowerShell cmdlets are:
- Backup-SPConfigurationDatabase which is used take a 'configuration only' backup of the current farm or a 'configuration only' backup of a separate configuration database which is not attached to the current farm.
- Get-SPBackupHistory is used display the history of backup and restore operations run so far on the specified location.
- Review the tip on Backing up SharePoint 2010 with SQL Server.
- Review the Backup and recovery overview on technet.
- Review the Plan for backup and recovery article on technet.
Last Updated: 2010-10-21
About the author
View all my tips