Thursday, July 26, 2012

Major differences between STSADM Export/Import and Backup/Restore operations

Both these commands are primarily designed to back up data. But they work differently.
Based on your need, you can use either one of them.

stsadm –o backup/restore

With the URL and filename parameters, it allows you to backup either a site collection or web application. We can basically consider the file generated as a SQL dump of your content database.

Backup/Restore 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.
This was done on purpose, because Sites table in configuration database uses SiteID as the primary key.

This is very important because it allows you to restore the backup in the same farm in which you did the backup. You can even restore the same backup in the same farm as many times as you want, but we should always restore it in a different content database, since the GUID of all other object remains unchanged. This operation is designed to take an exact copy of a site collection; no data will be changed, transformed or lost.

stsadm –o export/import

This is the only standard operation that allows you to backup data of a sub site, but it can also export a site collection, an entire web application, or a single list. It generates a new GUID for every object - sites, sub sites, lists and items.

Another difference is that you can restore the content in an existing site; the behavior with existing data is defined with the parameter update versions in import operation.
A major drawback of this operation is that it does not preserve 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.
Contrary to the backup operation, it does not matter on which content database you run import operation, and you can restore a top site as a subsite, and reciprocally (except for sites with publishing feature where it is not supported:

This operation is good for merging content of sites, and to decide how to handle identical data between source and target. Very important, do not forget to use includeusersecurity parameter in both export and import if you wish to preserve information relative to permissions and other properties such as documents authors.

No comments:

Post a Comment