Sharepoint

SharePoint Backup Best Practice

maaz uddin

Published on 09 Jul.





    Want to be a part of Awesome Tech family?

    Bring to the table win-win survival strategies to ensure proactive domination.

    Share

    A backup is a copy of data that is used to restore and recover that data after a system failure. While backups allow you to restore data after a failure they are also useful to keep for routine purposes. These purposes include copying a database from one server to another, setting up database mirroring, and archiving to comply with regulatory requirements.

    Types of backup in SharePoint 2013

    • Farm Backup
    • Site Collection Backup

    Farm Backup

    The farm backup architecture in SharePoint 2013 starts a SQL Server backup of content and service application databases, writes configuration content to files, and also backs-up the Search index files and synchronizes them with the Search database backups.

    To back up a farm by using PowerShell command
              Backup-SPFarm -Directory <BackupFolder> -BackupMethod {Full | Differential} [-Verbose]
    To back up a farm by using Central Administration

    1. To perform this procedure, you must be a member of the Farm Administrators group on the computer that is running Central Administration.
    2. In Central Administration, on the Home page, in the Backup and Restore section, click Perform a backup.
    3. On the Perform a Backup — Step 1 of 2: Select Component to Back Up page, select the farm from the list of components and then click Next.
    4. On the Start Backup — Step 2 of 2: Select Backup Options page, in the Backup Type section, select either Full or Differential.

    Site Collection Backup

    This Backup is called Granular backup. The architecture uses Transact-SQL queries and export calls. It will create .bak file for restore Site. Granular backup and export is a more read-intensive and processing-intensive operation than farm backup. It will backup the whole website including Libraries, Lists, and workflows, etc.
    To backup a site collection using powershell command
    Backup-SPSite <URL of your site> -Path <file path to store backup file>
    for  e.g :  Backup-SPSite http://yoururl/ -Path C:\Backup\site_name.bak

    Daily Backup Site Collection Scheduler

    Following Steps are required to run site collection backup daily.
    1. Create new file in notepad and copy this text.
    #Backup location
    $backupLocation = “C:\\”
    #Site collection location
    $sitecollection = http://yoursitename/
    #daily backup filename
    $dailybackupfile = Join-Path -Path $backupLocation -ChildPath (“yourfilename_” + (Get-Date -UFormat “%Y-%m-%d-%A”) + “.bak”)
    $snapin = Get-PSSnapin | Where-Object {$_.Name -eq ‘Microsoft.SharePoint.Powershell’}
    if ($snapin -eq $null) {
    Write-Host “Loading SharePoint Powershell Snapin”
    Add-PSSnapin “Microsoft.SharePoint.Powershell”
    }
    if(!(test-path $backupLocation -PathType Container))
    {
    “Backup location (” + $backupLocation + “) not found.”
    break
    }
    Backup-SPSite -Identity $sitecollection -Path $dailybackupfile –Force
    copy $dailybackupfile –Force
    2. Save file as with “.ps1” extension
    3. Open window Task Scheduler
    1) Open Task Scheduler
    2) Create New Task
    3) Enter Task Name
    4) Select Task Schedule
    5) Set Backup timing
    6) Select Task Type
    7) Set path of powershell script file
    8) Finish
    9) Backup will run every day at the time you specified.

    Leave a comment