Monday, 24 February 2014

Difference between Backup/Restore and Export/Import

Backup-SPSite:

Backup-SPSite is generally used when you want to replicate the entire site collection (including all subsites) to an existing web application.

It allows you to backup either a site collection or web application.
You can basically consider the file generated more or less as a SQL dump of (a part of) your content database.It preserves the GUID of every object except the GUID of the Site.
When you restore the backup, SharePoint generates a new GUID for the site collection.

Export-SPWeb:
Export-SPWeb is generally used when you want to replicate just a single subsite to an existing site collection, that allows you to backup data of a sub site (SPWeb object), but it can also export a site collection, an entire web application, or a single list. It generates a new GUID for every objects such as sites, sub sites, lists and items.

A major drawback of this operation is that it does not preserves workflows instances, associations, history and tasks.Every workflow association must be recreated and there is no way to restore the running instances from original site.

Export/import is often used to split site collections into multiple pieces when they reached a certain limit. Or to do the vice versa and consolidate multiple site collections into one larger one. Both of these actions work fine as long as the migrated content does not use the publishing feature.

Example for Subsite backup and restore:

Export-SPWeb -Identity http://spsdemo:9999/Subsite1 -Path "D:\Exports\Subsite1"
Import-SPWeb http://spsdemo:6666/Subsite2 -Path "D:\Exports\Subsite1.cmp"

Example for list backup and restore:

Export-SPWeb http://spsdemo:9999/ -ItemUrl "/Lists/Test%20docs/" -Path "D:\Exports\TestDoc"
Import-SPWeb -Identity http://spsdemo:6666 -Path "D:\Exports\TestDoc.cmp"


1 comment: