Backup and restoration
of user data and system configuration is an intricate part of disaster
recovery planning. After all, the user data is most precious and
typically tantamount to the running of the organization’s business.
SharePoint 2013 includes a number of backup and restoration methods,
from complete farm backup/restore to granular backup/restore, such as
site import and export and site collection backup. In this section, I
will visit each method and discuss the specific benefits and
shortcomings of each, enabling you as the SharePoint administrator to
make effective decisions in your disaster recovery plan.
As a general rule of
thumb, I recommend that you employ various backup methods to ensure
that you are able to recover your SharePoint farm in the event of a
disaster. The following list summarizes, from a high level, what you
should back up:
- All content databases
- All configuration and service application databases
- The SharePoint 2013 hive on each web server (c:\program files\common files\Microsoft shared\web server extensions\14\)
- All virtual application directories on each web server (c:\Inetpub\wwwroot\wss\VirtualDirectories)
- Any custom databases or additional files that do not live in the hive or virtual application directories on each web server
- Site collection backups for faster restore, in the event of
isolated data corruption or data loss in a particular site collection
When it comes to backup, more is better. If
space for backup is not as plentiful, then backup of all databases and
custom “changes” to the hive and virtual application directories should
allow you to recover your farm after a new installation.
With the high-level stuff out of the way, I shall now detail the various backup methods available in SharePoint 2013.
1. Site Collection Backups
Site collection backups are compelling in
that they enable administrators to save a complete site collection to a
file on disk. Administrators may back up a site collection using the
STSADM command, PowerShell, or Central Administration.
Note Site
collection backup puts stress on SharePoint and consumes resources to
complete the process. Microsoft does not recommend backing up site
collections of more than 15GB, because of the drain on the live site
collection, hosting web application, and the time to complete the
backup. Site collection backup works well when moving data from one
farm to another, or in conjunction with another backup scheme to ensure
data integrity.
Site Collection Backup and Restore Using PowerShell
The following steps demonstrate backing up a site collection to a disk file, using PowerShell:
- From the Start menu, choose All Programs.
- Click Microsoft SharePoint 2013 Products.
- Click SharePoint 2013 Management Shell to launch the console.
- Type the following text into the console, replacing the appropriate placeholders:
Backup-SPSite <site collection URL> -Path <backup file> [-Force] [-NoSiteLock] [-UseSQLSnapshot] [-Verbose]
Include the [Force] parameter to overwrite an existing backup file. I recommend not using the [NoSiteLock]
option, as this prevents SharePoint from putting the site collection in
read-only state, meaning that users can write to the site collection
during backup and potentially corrupt the database. Use the [UseSQLSnapshot] option if you have SQL Server Enterprise edition, for more consistent backup. The [Verbose] option provides additional output.
Now that I have shown you how to back up your
site collection, restoring it is just as easy. The following command
demonstrates restoring a site collection from a backup file, using
PowerShell:
Include the [Force] parameter to overwrite an existing backup file. Use the [-DatabaseServer] option if the server is not part of your farm. Include the [-GradualDelete]
option to minimize locks on the database and provide for better restore
performance for backups over 1GB when replacing an existing site
collection, which SharePoint marks as deleted; the timer service
deletes the legacy site collection later. Use the [-HostHeader] option if restoring a site collection to a web application that requires a unique host header.
Site Collection Backup and Restore Using STSADM
Use the following STSADM command, inside a
command shell, to back up a site collection to a disk file, replacing
the appropriate placeholders:
STSADM –o backup –url <site collection url> -filename <filename>
Similar to the PowerShell command for backing up a site collection, you may provide the -overwrite option to overwrite an existing backup file, -nositelock to prevent site collection lock, and -usesqlsnapshot
to use SQL Server Enterprise snapshot. Use the following STSADM command
to restore a site collection from a backup file, replacing the
appropriate placeholders:
STSADM –o restore –url <site collection url> -filename <filename>
Similar to the PowerShell command for restoring a site collection, you may provide the –overwrite option to overwrite an existing site collection, -hostheaderwebapplicationurl to provide a host header URL, and -gradualdelete
to provide better performance in overwriting an existing site
collection (marks the overwritten site collection as deleted and the
timer service deletes it later).
Site Collection Backup and Restore Using Central Administration
The following steps demonstrate backing up a site collection to a disk file, using Central Administration:
- Open Central Administration.
- Click the Backup and Restore heading.
- Click the Perform a Site Collection Backup link. You will see a page like that in Figure 1.
- Click the drop-down control to change the site collection.
- In the resulting dialog box, select the web application containing the site collection.
- Provide the UNC path of the file name to save the backup.
- Click the Start Backup button.