SharePoint Backup Best Practice

When it comes to SharePoint Backup, you should take a break from work and do some serious thinking. It’s really not all that easy as Microsoft makes it look. Don’t count on built-in backup to save your bacon. There is no Best Practice for backing up your SharePoint Farm. But I do have a few good advise to give out.

Before I do that, let me just set the scene. I do backups for companies that have between 100 GB. and 500 GB. of SharePoint Storage. I’m sure that companies with more than 2 TB. of SharePoint Storage, does it quite differently. They most likely use DPM or some enterprise Backup Solution. This guide is for those who don’t have that kind of budget. If you work for one of those companies, I would really like your input to how you do backups.

Trust is a fickled friend

I never trust anything digital, that I only have one copy of. I take the same approach to my backups. So I have 2 approaches to backups.

  1. Full server image backup (This is very simple. Just use Veam to take a nightly Image backup of all servers)
  2. Content and configurations backup

Content, Configuration and Service Applications Backups

I do Configurations and Service Applications backup via PowerShell and Content backup via native SQL backup. I read somewhere that PowerShell doesn’t support backing up databases above 200 GB. but I can’t seem to validate that, so if anyone knows better, feel free to educate me via the comments.

My clients like to keep their backups around for one month. That means that I keep 2 months of backup.

You can bet your car that one day they will come asking for that content that is 31 days old

Aside from this backup you could do a separate SiteCollection Backup. I don’t.. yet. On another note. Don’t listen to those bloggers out there that tell you to use the Backup-SPConfigurationDatabase cmdlet. That cmdlet is intended for inactive Farms only. Always use the Backup-SPFarm cmdlet.

SharePoint Backup – Howto

  1. Create PowerShell Script to backup all your configurations and SA in a month-by-month folderstructure
  2. Create Scheduled Task to execute that PowerShell Script
  3. Create  Maintenance Plan on your SQL Server to:
    1. Check integrity of all SharePoint Content Databases
    2. Back ’em up to a folderstructure, with one folder per database
    3. Delete backup history older than 9 weeks
    4. Delete all files older than 8 weeks

1. PowerShell Script

I found this PowerShell script to backup all your configurations and Service Applications over at My SharePoint Adventure. You should take a look at the original and see id it fits your requirements better. I’ve changed it to match some of my requirements and changed the use of Backup-SPConfigurationDatabase to Backup-SPFarm.


<h1>==========================================================================</h1>

<h1>NAME: Backup-Config-SA.ps1</h1>

<h1>COMMENT: Script to take backup of Config and Service Applications</h1>

<h1>Date: June 16. 2013</h1>

<h1>Author: Ulrich Gerting Bojko, http://getinthesky.com</h1>

<h1>==========================================================================</h1>

Add-PsSnapin Microsoft.SharePoint.Powershell –ErrorAction SilentlyContinue

#Variables
$ThisMonth = Get-Date -Format yyyy-MM
$CleanupMonth =  (Get-Date).AddMonths(-2).ToString('yyyy-MM')
$logfile = &quot;&#92;backup\Backup\SharePoint\Log\SPFarm-Backup-&quot; + $(Get-Date -Format dd-MM-yyyy) + &quot;.log&quot;
$BackupConfigFolder = &quot;&#92;backup\Backup\SharePoint\Config\&quot; + $ThisMonth
$BackupSAFolder = &quot;&#92;backup\Backup\SharePoint\ServiceApp\&quot; + $ThisMonth
$BackupConfigFolderClean = &quot;&#92;backup\Backup\SharePoint\Config\&quot; + $CleanupMonth
$BackupSAFolderClean = &quot;&#92;backup\Backup\SharePoint\ServiceApp\&quot; + $CleanupMonth
$AdminEmail = &quot;user@domain.com&quot;
$MailServer = &quot;SMTPServer&quot;
$FromAddress = &quot;user@domain.com&quot;
 
Write-Host &quot;Backup Script is starting.... Please standby!&quot;
 

<h1>Backup Farm Configuration</h1>

try
{
    ac $logfile &quot;$(Get-Date)<code>t Clearing old configuration backups..&amp;quot;
    Remove-Item -Recurse -Force $BackupConfigFolderClean
    ac $logfile &amp;quot;$(Get-Date)</code>t Done.&quot;
    ac $logfile &quot;$(Get-Date)<code>t Backing up SharePoint Farm Configuration.. &amp;quot;
    [IO.Directory]::CreateDirectory(&amp;quot;$BackupConfigFolder&amp;quot;)
    Backup-SPFarm -ConfigurationOnly -Directory $BackupConfigFolder -BackupMethod Full -Verbose -Percentage 15
    ac $logfile &amp;quot;$(Get-Date)</code>t Done.&quot;
}
catch [system.exception]
{
        ac $logfile &quot;$(Get-Date)`t An error occured while backing up the farm configuration database: $<em>.&quot;
    $messageParameters = @{
    Subject = &quot;Backup Failed: Farm Configuration Database&quot;
    Body = &quot;ERROR $</em>.&quot;
    From = $FromAddress
    To = $AdminEmail
    SmtpServer = $MailServer
}
    Send-MailMessage @messageParameters
}
 

<h1>Backup Service Applications</h1>

try
{
    ac $logfile &quot;$(Get-Date)<code>t Clearing old service application backups..&amp;quot;
    Remove-Item -Recurse -Force $BackupSAFolderClean
    ac $logfile &amp;quot;$(Get-Date)</code>t Done.&quot;
    ac $logfile &quot;$(Get-Date)<code>t Backing up SharePoint Farm Service Applications.. &amp;quot;
    [IO.Directory]::CreateDirectory(&amp;quot;$BackupSAFolder&amp;quot;)
    Backup-SPFarm -Directory $BackupSAFolder -BackupMethod Full -Item &amp;quot;Farm\Shared Services&amp;quot; -Verbose -Percentage 15
    ac $logfile &amp;quot;$(Get-Date)</code>t Done.&quot;
}
catch [system.exception]
{
    ac $logfile &quot;$(Get-Date)`t An error occured while backing up the service application database: $<em>.&quot;
    $messageParameters = @{
    Subject = &quot;Backup Failed: Service Application Database&quot;
    Body = &quot;ERROR $</em>.&quot;
    From = $FromAddress
    To = $AdminEmail
    SmtpServer = $MailServer
}
    Send-MailMessage @messageParameters
}
 
Write-Host &quot;Back is done. Come back soon!&quot;

Database Backup

Now you’ve got your configurations and service applications backed up up in an orderly fashion, lets take a look on how to backup the actual SharePoint content. There are several ways to backup your data. You could script a PowerShell backup of your SiteCollections one-by-one. I recommend doing that too. In this case, I choose database backups using the native SQL-backup. Doing SiteCollection is just Backup-SPSite. Then fill in the blanks.

Create a maintenance plan with 3 subplans.

1. Full Backup (Once every month)

  1. Schedule:
    Sql-backup-ScheduleFull
  2. Check Database Integrity:
    Select your Content DB’s
    Sql-backup-IntegrityCheck
  3. Back Up Database:
    Backup type: Full
    Select same Content DB’s as in step one
    Sql-backup-Full
  4. Maintenance Cleanup:
    Select your backup destination and delete all “bak” older than 8 weeks
    Sql-backup-MaintenanceCleanup
  5. History Cleanup:
    Sql-backup-HistoryCleanup

2. Differential Backup (once a day)

  1. Schedule:
    Sql-backup-ScheduleDiff
  2. Check Database Integrity (same settings as when doing full backups)
  3. Back Up Database:
    Backup type: Differential
    Select same Content DB’s as in step one
  4. Maintenance Cleanup:
    Select your backup destination and delete all “trn” older than 3 days
    Sql-backup-MaintenanceCleanupTRN

3. Transaction log Backup (once every hour during business hours)

  1. Schedule:
    Sql-backup-ScheduleTRN
  2. Back Up Database:
    Backup type: Transaction log
    Select same Content DB’s as before
    Sql-backup-TRN

Tweet me

That’s it. You are done. Heres some last good advise, that i’ve picked up along the way:

  • Remember to do a full recovery drill once a while to check that your backups actually works like you expect.
  • Remember to check that your backup-user has full rights to the backup folder. If not, your PowerShell backups will not toss you an error. They will just fail on restore. Learned that the hard way.
  • Always keep backup longer than your client expects. It can save the day.
  • Use “domain attached” network drives. Don’t use a NAS where you cannot login with your AD-service account. It will fail your PowerShell Restores.
  • The HP Micro server is a good choice

I hope you’ve enjoyed this post on SharePoint Backup. If you like it, please consider sharing it with your social network.

13 thoughts on “SharePoint Backup Best Practice”

    • Hi Gareth: Thank you for the question. I would keep it until I have two differential backups. If your diff backups are once a day, then two days, If once a week, then two weeks. Always bear in mind that you have to have enough backups so the nearest one (latest diff. for instance) can fail, without your whole system being at risk. I’ve seen and experienced more than once, that restore of backups do fail. So I always double down on backups.

  1. Gareth… Is this appropriate for SharePoint 2013? We have just upgraded to SP 2013 and I’m working on a solid backup plan for SP2013.

    Great post!

  2. Great post! Could you clarify – how do I know which databases to back up within SQL Server? I am currently backing up every database with a SQL Agent job. If I add the PowerShell tasks for “ConfigurationOnly” and “FarmShared Services”, that is all I need to do? (With the exception of IIS settings, and other things outside of SharePoint)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.