Monday 4 February 2013

Backup/Restore of SharePoint 2010 site Collection using Power Shell


1. On the Start menu, click All Programs.
2. Click Microsoft SharePoint 2010 Products.
3. Click SharePoint 2010 Management Shell.
4. At the Windows Power Shell command prompt type the following command:

To take a backup of  a site collection in sharepoint 2010,

Backup-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

Ex:
Backup-SPSite -Identity http://servername/sites/BISite -Path D:\SharePointBackups\BISite\07-13-2011.bak -force
  • Force – Include this if you want to override a backup with the same name.
  • NoSiteLock – Will prevent the site from going to Read Only mode while the backup is being taken.  A small warning, if someone changes content on the site while the backup is being created and according to Microsoft “might lead to possible data corruption”.
  • UseSQLSnapshot – A database snapshot will be taken before the backup begins and the backup will be done off the snapshot. The advantage is that changes can be made to the site while the backup process is running without fear of corruption.  The snapshot will be deleted automatically when the backup is completed.  You don’t need to specify the -NoSiteLock parameter when using this method
5. Once this done you will get the backup in the specified path.

6. Next you have to create site collection then use the below command to restore the backup that we currently taken.

Restore-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere [-DatabaseServer DatabaseServerNameHere] [-DatabaseName ContentDatabaseNameHere] [-HostHeader HostHeaderHere] [-Force] [-GradualDelete] [-Verbose]

Ex:
Restore-SPSite -Identity http://servername/sites/TestSite -Path D:\SharePointBackups\BISite\07-13-2011.bak -force -force
  • DatabaseServer – Specify the server for the content database
  • DatabaseName – Specify the name of the content database
  • HostHeader – URL of the Web application that will hold the host-named site collection
  • Force – Overwrite the site collection if it exists
  • GradualDelete – Recommended for site collections over 1 Gig in size, existing data is marked as deleted and gradually removed over time by a job rather than all at once to reduce the performance hit of deleting large amounts of data
I am using force command because I want to overwrite the existing site collection that I created now.
_________________________________________________________________________
Using STSADM

When you back up by using the Stsadm command-line tool, you can back up individual aspects of your SharePoint Products and Technologies deployment. For example, you can back up an individual site collection or you can back up the entire farm.
To export sites from your SharePoint Products and Technologies deployment, you use the following Stsadm command.

Stsadm –o export –url <URL> -filename <FileName>.cmp

To back up a site collection, you must use the following stsadm command.

stsadm –o backup –url <URL of the site collection> -filename <Name of the backup file> 

To back up an individual database, Web application, or the entire farm, you can use the following Stsadm command.

stsadm –o backup –directory <UNC path or local drive> -backupmethod <Full or Differential>

Restore

To import sites to your SharePoint Products and Technologies deployment, you use the following Stsadm command.

Stsadm –o import –url <URL> -filename <FileName>.cmp

To restore a site collection, you must use the following Stsadm command.

stsadm –o restore –url <URL of the site collection> -filename <Name of the backup file>

To restore an entire farm you can use the following Stsadm command.
stsadm –o restore –directory <UNC path or local drive> -restoremethod <overwrite or new>

_________________________________________________________________________
you can take SharePoint Central administration UI to do the backup/restore.

Backup Steps

1. Navigate to the Central Administration => Backup and Restore

2. Under “Farm Backup and Restore” section click “Perform a backup”.

3. Now you’ll be landed in the following page where you can select the site or site collection you want to take backup:

4. Click next and you’ll be navigated to the page where you can select backup type (full or differential) and backup location:

5.Give the backup location and click "Start Backup".

Restoring Steps

1. Navigate to the Central Administration => Backup and Restore.

2. Under “Farm Backup and Restore” section click “Restore from a backup”. Follow the wizard to restore from a backup.

Difference between: Full, Differential, and Incremental Backup


TypeDefinitionBenefitsDrawbacks
Full Backup:A complete backup of everything you want to backup.Restoration is fast, since you only need one set of backup data.The backing up process is slow.
High storage requirements.
Differential Backup:The backup software looks at which files have changed since you last did a full backup. Then creates copies of all the files that are different from the ones in the full backup.

If you do a differential backup more than once, it will copy all the files, or parts of files that have changed since the last full backup, even if you already have identical copies of those files in a previous differential backup.

For restoring all the data, you will only need the the last full backup, and the last differential backup.
Faster to create than a full backup.

Restoration is faster than using incremental backup.

Not as much storage needed as in a full backup.
Restoration is slower than using a full backup.

Creating a differential backup is slower than creating an incremental backup.
Incremental Backup:The backup software creates copies of all the files, or parts of files that have changed since previous backups of any type (full, differential or incremental).

For example if you did a full backup on Sunday. An incremental backup made on Monday, would only contain files changed since Sunday, and an incremental backup on Tuesday, would only contain files changed since Monday, and so on.
This method is the fastest when creating a backup.

The least storage space is needed.
Restoring from incremental backups is the slowest because it may require several sets of data to fully restore all the data. For example if you had a full backup and six incremental backups. To restore the data would require you to process the full backup and all six incremental backups.



1 comment:

  1. I like what you guys are up too. Such intelligent work and reporting!Keep up the excellent works guys I have incorporated
    sharepoint administrator training

    ReplyDelete