Site collection backup/restore vs. site export/import with focus on running workflows, version history and auditing

Custom SharePoint solutions usually contain custom lists with custom event receivers, custom workflows, maintain version history, use auditing etc. For a site with lists that have those customization it’s important to make sure that the backup/restore process will not lose any of the running workflows, workflow tasks and their status, items version history (major and minor versions), registered audit events etc.

Regarding audit events, in fact they are saved in Audit table in the content database and site backup/restore or export/import will not affect that table but can make other changes(for example new site GUID) which will result in invalid rows in that table (one of the columns is Site ID (GUID)).

Database attach is always the best way to avoid any problems of this kind but in some cases for various reasons very frequent backup of the content database is not preferred and backup of a single site collection (SPSite) or single site (SPWeb) is required. Another reason for testing site export/import is that I’ve seen administrators using export/import for migration to another location and as a more frequently running backup plan and I was asked is it safe to do that for custom solution.

Test case

I tested site collection backup/restore and site export/import in SharePoint 2010. In the site there was a document library with versioning (major and minor) enabled, auditing was enabled and there were custom workflows associated with the list. In the time of back up there were documents in minor and major version. Also some of the documents had workflows in running state. After the backup some versions from items versions history were deleted, running workflows were completed and workflows on other items were started. Also some of the documents were deleted and new documents created. After that the restore/import was performed and the restored/imported site was compared with the original state (state when the site was backed up/exported). Import of the exported site was tested by importing on the same location and also importing on another sub site.

Below are the commands for backup/restore and export/import and the results after restore/import. The focus is on running workflows, version history and registered auditing events.

Site collection backup

PowerShell command to backup a site collection

        Backup-SPSite -Identity "site collection url" -Path "backup file path"

More information for Backup-SPSite:

Site collection restore

PowerShell command to restore a site collection

	Restore-SPSite -Identity "site collection url" -Path "backup file path"

More information for Restore-SPSite:

Restore results:

The results are the same when restoring on the same location or another location, in the same web application or another web application.


  • The restored site collection has new site ID (GUID).
  • All items versions are restored successfully with the original correct datetime value for every version.
  • All items workflows are restored successfully
  • Audit events are lost. This happens because of the new site ID (GUID). This can be fixed by updating Audit table in the content database. If the site collection is restored in the same location or another location that uses the same content database then rows in Audit table should be updated by writing the new Site ID in the rows that have the old Site ID. If the restore is done on another location that uses another content database then new rows must be created in the Audit table in the new content database by reading the old audit events from the Audit table in the old content database.

Site Export

PowerShell command to export SPWeb:

	Export-SPWeb [-Identity] "site url or GUID" -Path "backup file path"

More information for Export-SPWeb:
Important: Export-SPWeb does not export the running workflows.

Site import

Powershell command to import SPWeb:

	Import-SPWeb [-Identity] "site url or GUID" -Path "backup file path"

More information for Import-SPWeb:

Import in the same location

If there are event receivers running custom code in the lists it’s recommended to remove all of them before import to avoid any failure caused by the event receiver logic. Depending on the logic of the event receivers import may completely fail or the imported web may have wrong items version history and other problems. After import event receivers can be added back. For removing/adding event receivers with PowerShell check one of my older posts Add, Modify or Delete List Event Receivers with PowerShell

Import results:

  • Import operation does not import the workflows (as expected, because they don’t get exported with Export-SPWeb).
  • Import does not affect the currently running workflows but import of the document versions fails for those documents with running workflow.
  • Versions are imported only for document with no workflows in running state when importing.
  • Versions date and time are lost. All versions have datetime value of the time when the import has been performed.
  • Audit events are not affected by the import, so all events are retained including those registered between export and import

Import in another sub site

The following must be done before importing the exported site:

  • Create new site using the same template and same language as the exported site
  • As explained above, removing event receiver is strongly recommended

Import results:

  • All running workflows are lost
  • All custom site properties and custom item properties are lost (properties in SPWeb.Properties and SPItem.Properties hashtables)
  • All workflow associations are lost
  • Document versions are imported but date and time for the versions are lost. All versions have datetime value of the time when the import has been performed.
  • Audit events are lost
  • Workflow tasks are lost


Database attach of a backed up content database is superior for custom SharePoint solutions that contain custom workflows, custom web and item properties, custom event receivers, version history etc. To avoid big content database and long backup times its better the custom solutions to be installed in a site collection that has its own content database instead of sharing one content database with other site collections. That way backup/restore space and time will stay in normal and manageable boundaries. In that case you can stick to database backup as the best backup/restore plan for highly customized and big SharePoint solution.

Site collection backup/restore is better than SPWeb export/import but not as trouble free as database backup/restore plan. The problems are caused by the new Site ID (GUID) generated. That causes lose of audit events, or more precisely additional work to correct the Audit table after the restore.

Site export/import is almost useless for custom solutions that contain custom workflows, event receivers, custom web and item properties, custom event receivers, version history etc. It has problems even if it’s used for simple sites that use only SharePoint out of the box functionality if it has lists with workflows and versioning enabled.


10 Responses to Site collection backup/restore vs. site export/import with focus on running workflows, version history and auditing

  1. Pingback: Meilleur moyen OOB pour dupliquer une collection de site | GhislaInfo

  2. says:

    I wish i would of read this article about 3 months ago. I just migrated a whole bunch of sites from one farm to another using export/import. All the sites with workflows no longer have a workflow associated with them. On top of that If I create a new workflow it will associate to the list but it wont actually show up on list to run. Do you know how to fix the issue?

    • Naim Murati says:

      I need more info what kind of workflow are you creating and how did you attach it to the list?
      First step, go to the page for deleting workflows and check is the workflow allowed?

  3. Anonymous says:

    Great article..

  4. Anonymous says:

    Good post with important information that is not documnted by MicroSoft!

  5. C U says:

    Great post of important for me previously unknown (and undocumented?) information.

  6. Great article. Have you already tried multilingual webs? It seems there are some drawbacks to it…

  7. Kurt says:

    Is updating the audit table supported by Microsoft? Since the general advice is ‘don’t touch the content databases’

    • Naim Murati says:

      Updating the data in the audit table should not be a problem as long as you don’t change the schema, views, indexes…(those are things that may cause the future updates to fail), but its always better to confirm with Microsoft before doing it on a production environment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: