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.
- Full server image backup (This is very simple. Just use Veam to take a nightly Image backup of all servers)
- 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
- Create PowerShell Script to backup all your configurations and SA in a month-by-month folderstructure
- Create Scheduled Task to execute that PowerShell Script
- Create Maintenance Plan on your SQL Server to:
- Check integrity of all SharePoint Content Databases
- Back ’em up to a folderstructure, with one folder per database
- Delete backup history older than 9 weeks
- 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 = "\backup\Backup\SharePoint\Log\SPFarm-Backup-" + $(Get-Date -Format dd-MM-yyyy) + ".log"$BackupConfigFolder = "\backup\Backup\SharePoint\Config\" + $ThisMonth$BackupSAFolder = "\backup\Backup\SharePoint\ServiceApp\" + $ThisMonth$BackupConfigFolderClean = "\backup\Backup\SharePoint\Config\" + $CleanupMonth$BackupSAFolderClean = "\backup\Backup\SharePoint\ServiceApp\" + $CleanupMonth$AdminEmail = "user@domain.com"$MailServer = "SMTPServer"$FromAddress = "user@domain.com" Write-Host "Backup Script is starting.... Please standby!" <h1>Backup Farm Configuration</h1>try{ ac $logfile "$(Get-Date)<code>t Clearing old configuration backups..&quot; Remove-Item -Recurse -Force $BackupConfigFolderClean ac $logfile &quot;$(Get-Date)</code>t Done." ac $logfile "$(Get-Date)<code>t Backing up SharePoint Farm Configuration.. &quot; [IO.Directory]::CreateDirectory(&quot;$BackupConfigFolder&quot;) Backup-SPFarm -ConfigurationOnly -Directory $BackupConfigFolder -BackupMethod Full -Verbose -Percentage 15 ac $logfile &quot;$(Get-Date)</code>t Done."}catch [system.exception]{ ac $logfile "$(Get-Date)`t An error occured while backing up the farm configuration database: $<em>." $messageParameters = @{ Subject = "Backup Failed: Farm Configuration Database" Body = "ERROR $</em>." From = $FromAddress To = $AdminEmail SmtpServer = $MailServer} Send-MailMessage @messageParameters} <h1>Backup Service Applications</h1>try{ ac $logfile "$(Get-Date)<code>t Clearing old service application backups..&quot; Remove-Item -Recurse -Force $BackupSAFolderClean ac $logfile &quot;$(Get-Date)</code>t Done." ac $logfile "$(Get-Date)<code>t Backing up SharePoint Farm Service Applications.. &quot; [IO.Directory]::CreateDirectory(&quot;$BackupSAFolder&quot;) Backup-SPFarm -Directory $BackupSAFolder -BackupMethod Full -Item &quot;Farm\Shared Services&quot; -Verbose -Percentage 15 ac $logfile &quot;$(Get-Date)</code>t Done."}catch [system.exception]{ ac $logfile "$(Get-Date)`t An error occured while backing up the service application database: $<em>." $messageParameters = @{ Subject = "Backup Failed: Service Application Database" Body = "ERROR $</em>." From = $FromAddress To = $AdminEmail SmtpServer = $MailServer} Send-MailMessage @messageParameters} Write-Host "Back is done. Come back soon!"
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)
- Schedule:
- Check Database Integrity:
Select your Content DB’s - Back Up Database:
Backup type: Full
Select same Content DB’s as in step one - Maintenance Cleanup:
Select your backup destination and delete all “bak” older than 8 weeks - History Cleanup:
2. Differential Backup (once a day)
- Schedule:
- Check Database Integrity (same settings as when doing full backups)
- Back Up Database:
Backup type: Differential
Select same Content DB’s as in step one - Maintenance Cleanup:
Select your backup destination and delete all “trn” older than 3 days
3. Transaction log Backup (once every hour during business hours)
Tweet me
- Good post on SharePoint Backup Best Practice – Click to Tweet
- This is how Backup on SharePoint could be done – Click to Tweet
- Splitting SharePoint Backups between PowerShell and SQL – Click to Tweet
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.
Leave a Reply