Scheduling SharePoint 2010 backups

Hello Community,

After many time of abscense I'm back to continue providing you with more information that can be valuable or useful, this time for SharePoint 2010 beginners that would like to know the new OOB Backup/Restore features and how to schedule backups using Windows scheduled tasks.

First we need to know and understand SharePoint Central Administration site options

As we can see on the image above we have 2 categories "Farm Backup and Restore" & "Granular Backup".

  1. The first options are to backup and restore the entire farm
  2. Then we can configure backup options like: Number of threads and backup file path
  3. Also we can check the history for both backups and restores
  4. And finally a shortcut to the timer job status in charge of execute backups or restorations

Here we have granular backup options now. SharePoint 2010 includes export/import options that was only available through stsadm in MOSS 2007, in order SharePoint administrator can execute a backup of a site, list or document library without PowerShell:

  1. Backing up particular site collections or sites, lists and document libraries
  2. Recover specific information from a content database that does not belong to a valid web application. In this way SharePoint administrator does not need to attach the content database* to the web application and then after recoverying data delete it once content was extracted, options available for this new feature are shown on image below:

3. Finally a shortcut to review the status of the granular backup

*ONLY databases that can be explored by option named "Recover data from an unattached content database" are the ones with SharePoint 2010 version. If you want to get information from a MOSS 2007 content database you will need migrate the content database to SharePoint 2010 first using PowerShell.

 

 

 

Using Windows Scheduled Tasks

Having scheduled backups are fundamental for SharePoint adminsitrators, most of the times this taks are executed overnight, first of all, to grant data integrity and get the last updated data ,and then to minimize performance impact because of the heavy I/O on disks

In this section you will find some examples with the correct syntaxis for PowerShell scripts, but first we need to build a .BAT file like this one

@echo on

SET SOURCE_SITE=<URL>
SET DEST=<Path>

powershell -command <PS1 File> %SOURCE_SITE% %DEST%
echo “Backup completed successfully at %DEST%” on %DATE% %TIME% >> <LogFileCustom>

 

Where:

<URL> Will be the Site Collection to be backed up

<Path> Path for the backup file. Drive:\backupintranet\backupintranet.bak

<LogFileCustom> Log file(Optional) Drive:\backupintranet\backupLog.txt

<PS1 File> PowerShell script location Drive:\backupintranet\Bckptl.ps1

 

But, what's inside PS1 file?, we have many options. Before we need to understand that SharePoint Central Administration site only allows us to make backups of the entire farm or at web application level only, but not for a specific site collection or site, we need to highlight that SharePoint administrator will be able to restore SharePoint objects as fast as possible, rather than restoring the entire content inside the content database that can be 200 GB of size and taking hours to be restored.

Well PS1 file MUST start with the following line in order to start PowerShell

Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

What we have for backups:

Site Collections:

Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose] (https://technet.microsoft.com/en-us/library/ee748617.aspx)

Sites, Lists or Document Libraries

Export-SPWeb -Identity <Site URL> -Path <Path and file name> [-ItemUrl <URL of site, list, or library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose] (https://technet.microsoft.com/en-us/library/ee428301.aspx)

Never forget that file extensions for sites, lists and document libraries is CMP (Content Migration Package)

 

 

Farm configuration

Backup-SPConfigurationDatabase -Directory <BackupFolder> -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName> -DatabaseCredentials <WindowsPowerShellCredentialObject> [-Verbose] (https://technet.microsoft.com/en-us/library/ee428320.aspx)

This last option is a new feature in SharePoint 2010 that allows SharePoint administrator to backup farm CONFIGURATION located in Configuration database, the objective is to restore some configuration settings in a different Configuration database like a DRP SharePoint farm (Disaster Recovery Plan)

 

If you want to know more backup/restore options and some PowerShell sample scripts for SharePoint 2010 you can check the following technet article:

https://technet.microsoft.com/en-us/library/ee428315.aspx

See you soon...!!!