SharePoint 2010 Granular Backup-Restore Part 1


Hello! Russ Maxwell here and I’d like to provide a glimpse into SharePoint 2010 granular backup/restore. Several things have changed and have been improved in this area. This article is specifically themed around granular backup\restore and what you need to know.


Key Concepts:


Granular Backup: Granular backup has been placed into its own section within Central Administrator. This includes multiple options including the following options:


· Perform a site collection backup


· Export a site or list


· Recover data from an unattached content database


clip_image002




Basics


In SharePoint 2007, all granular backup and restore operations were only available using stsadm. SharePoint 2010 has integrated granular backup restore operations into both Central Administrator and PowerShell. Some backward compatibility does exist with stsadm but PowerShell is the new and improved replacement. Stsadm will be left out of this blog. Part 1 of this blog will include all granular backup/restore options except for “Recover data from an unattached content database”. Part 2 of this series will be dedicated to that topic. Performing backup operations deemed as granular can be performed from Central Administrator or PowerShell. Granular restore operations are only available using PowerShell. SharePoint 2010 is more flexible in terms of what can be backed up and restored. It’s possible to backup and restore site collection, sites, lists, document libraries, and items. The options for performing granular backups using Central Administrator are:


· Perform a site collection backup


· Export a site or list


· Recover data from an unattached content database (Covered in Part 2 of this series)



 


Granular backup operations


Backing up a Site Collection


You can backup a specific site collection using either Central Administrator or Powershell.


Using Central Administrator



  1. Select Backup and Restore

  2. From the UI select Perform a site collection backup

  3. Select the appropriate site collection from the pull down menu

  4. Include proper UNC path including backup file named like: filename.bak

  5. Selecting Start backup redirects to _admin/sitebackuporexportstatus.aspx page.



Using Powershell


backup-spsite -identity http://contosoweb -path \\server\backupshare\bufile.bak



 


Backing up a Site, Library, or List


Exporting a Site/sub-site


Export a specific site using Central Administrator:


1. Select Backup and Restore
2. From the UI select Export a site or list
3. Select Site Collection\Site “leave list drop down clear”
4. Optional categories is to export full security or export versioning history
5. Selecting Start export redirects to _admin/sitebackuporexportstatus.aspx page.


Using Powershell


export-spweb -identity http://contosoweb -path \\servershare\bu\site.cmp


Export a specific list or library:


1. Select Backup and Restore
2. From the UI select Export a site or list
3. Select Site Collection\Site
4. Select a list
5. Optional categories “export full security or export versioning history”
6. Selecting Start export redirects to _admin/sitebackuporexportstatus.aspx page.


Using Powershell


export-spweb -identity http://contosoweb -path \\servershare\bu\hrpowershell.cmp -itemurl /cake



Note: This example demonstrates exporting a document library named cake from Contosoweb site.






 


Granular restore operations


Granular restore operations require the use of Powershell as no UI in Central Administrator exists. Two cmdlets are available for granular restore operations.



restore-spsite


This cmdlet is used to restore site collections that have been backed up using “Perform a Site Collection Backup” in central administrator or backed up using backup-spsite cmdlet.


For Example: restore-spsite -identity http://contosoweb -path \\server\backupshare\backupfile.bak


You have plenty of parameters available but the example demonstrates the required parameters. To get the full scope of parameters you can run:


get-command restore-spsite -syntax



What you should know about using restore-spsite


The identity/URL parameter shouldn’t point to a site collection that is present. If the intention is to overwrite an existing site collection, you must use the -force parameter.






import-spweb


This cmdlet is used to restore sites, list, and libraries exported with “export site or list” option in central administrator or using export-spweb cmdlet.


For Example: import-spweb -identity http://contosoweb/ -path \\appserver\bu\list.cmp



Note: You can’t decipher if a list or library is being imported into the contosoweb site using import-spweb. This has been predefined in the backup prior to running import-spweb.


 




What you should know about using import-spweb


Sites and subsites: Importing a site/subsite works as long as you specify a URL with a site that contains a matching template. For Example, importing a team site to http://contosoweb requires that I first provision a site using the team site template using URL http://contosoweb. Attempting to import to a site using a blank template or different template will result in an error.


List and Libraries: It’s important to determine exactly what items you want to import into a list or document library. If no items exist, then running the command in the example above will suffice and all items will be imported. What if a user accidently deletes 5 items out of 1,000 and you simply want to restore those 5 items? By default, the import-spweb cmdlet overwrites items if they exist with the restored version. In this case, the item version prior to restore can be salvaged by restoring the previous version as long as versioning is enabled. To prevent a scenario where you want items which currently exists to be ignored by import operation, you must include the -updateversions parameter with ignore


So in this example, to restore 5 items without affecting the 995 items which currently reside in a list named odst I can run the following:


Import-spweb –identity http://contosoweb/ -path \\appserver\bu\odst.cmp -updateversion ignore


Note: New Items created within the ODST library after initial export will not be touched by an import operation.




 


Check Granular backup job status


A sleek new page has been added to check on granular job back status. Two ways to get to this page is through Central Administrator and after initiating a granular backup automatically redirects you to the _admin/sitebackuporexportstatus.aspx page.


clip_image004


Stay tuned for Part 2 of this series which I’ll discuss how SharePoint 2010 leverages snapshots using the Recover data from an unattached database option.


Comments (23)

  1. Joel Oleson says:

    Are workflows and alerts included in the import and export of a site or list?

    Joel

  2. Russmax says:

    No unfortunately, they aren’t included in the export/import operation.  

  3. Rez says:

    Is there a way to schedule backups through the GUI or do you have a run your own scheduled task with a powershell or stsadm command?

  4. Is there any possible to export a library subsite, example http:/localhost/Bse/proeyects. localhost is root site and Bse is a subsite but I get -identity an -urlitem error.

  5. Phil says:

    Thanks so much for this.  Was working all day yesterday on my first deployment of a custom SharePoint App (Subsite) from test to production with no luck.  Once i found this it took a couple of minutes!

    Now I just have to reconnect the workflows and I'm done!

  6. Ted says:

    Hi the central admin was use to do backup,  And is setup by someone else.   But how can i remove old backup?  The folder just keep growing and we will run out of space soon.

  7. ktk says:

    I have a situation where my sharepoint server 2010 is not available anymore but the sql server is available as it is in a different server. Will I be able to restore the sharepoint server in a new box using this existing sql server? Thanks in Advance,

  8. Mai Omar says:

    @ktk.. yes you can .. in your new installation just tell sharepoint to connect to an existing DB configuration.. and when creating your webapp, you can add content DB [the existing one that was used before].. there are many ways for this anyway…

    With my regards,

    Mai Omar

    Senior Solutions Developer

    Blog: http://maiomar.itegyptcorp.com

    Website: http://www.itegyptcorp.com

  9. Abhijit Sil says:

    Are page layouts, content types, publishing pages and publishing content areas are included in the import and export of a site?

  10. Mai Omar Desouki says:

    @Abhijiy Sil: yes all will come with u but ofcourse except any deployed custom development, u will have to deploy it again..

    With my regards,

    Mai Omar Desouki

    Senior Solutions Developer

    Blog: http://maiomar.itegyptcorp.com

    Website: http://www.itegyptcorp.com

  11. Mai Omar Desouki says:

    remember that u can also export permissions with your exporting site colleciton for example, this is available from central administration and more like exporting item version history..

    With my regards,

    Mai Omar Desouki

    Senior Solutions Developer

    Blog: http://maiomar.itegyptcorp.com

    Website: http://www.itegyptcorp.com

  12. eddykuan says:

    Directory \backupSharePoint does not exist or the SharePoint Timer service account does not have permission to read or write to the backup folder. Specify a different directory or ensure that the SharePoint Timer service account has read and write permissions on both the file share and the underlying folder.

  13. bkwdesign says:

    I upgraded a 2007 SP Blog (no customizations) to 2010 (well, really, I upgraded an entire site collection). All was well, except, the nature of upgrading kinda forces you to create a separate web app where you kick the tires before assimilating it with an existing 2010 site collection.

    So, once I was happy with my upgrade, I was ready to move the blog sub-site over to my main site collection. That's where I found this post and decided to use the Export/Import cmdlets.

    In general, the Export/Import worked fairly well. But, my Shared Documents library didn't carry over the default Views (AllItems.aspx) or Forms (DispForm / EditForm / Upload). This did not happen to other lists in the blog, near as I can tell.

    I've described this in some detail with screenshots here:

    code.bkwdesign.com/…/upgrading-a-2007-sharepoint-blog-to-2010

    Let me know if anyone has ideas on what I may have done wrong.

  14. Diane Shadia says:

    Hi,

    My export ended up in multiple .cmp files  (ex. file.cmp, file1.cmp etc.) Is it the same process to import and in what order (if any) would I import them. Sorry, this may seem like an easy question, but I can't seem to find the answer anywhere.

    Diane

  15. GeorgeBR says:

    Good luck with any of these commands, I haven't yet found a single one that works reliably!

    Message to Microsoft: We don't need 20 different ways of doing something, we just need ONE THAT WORKS!

  16. Anne O'Day says:

    There seems to be an error in the Powershell sample for exporting a doclib: export-spweb -identity http://contosoweb -path \serversharebuhrpowershell.cmp -itemurl /cake

    The forward slash before cake doesn't seem to be correct.  With slash I get "The URL provided is invalid …"  without the slash, the export works fine.

  17. nick43 says:

    Hi I followed the steps in order to restore a site. The site and its content restored succesfully. The same an for its subsites except that their content is not viewable. From the manage-> content and stracture i can see the pages, their history and their status (approved). Should I do any additonal steps?  

  18. Qadir Bux A. Munir says:

    I have tried to backup and restore lists succeded

  19. Vishnu More says:

    Very use full information.

    I got solution on my stuck point .

    Thanks..!!

  20. John says:

    Hello,

    It appears that the parameter -IncludeUserSecurity does not restore the permissions when document libraries or lists with unique permissions are restored.

    Import-spweb –identity http://contosoweb/ -path \appserverbuodst.cmp -IncludeUserSecurity

    Is this normal behaviour?

  21. GauravS says:

    Can we restore a list backup for a new list name??

    Ex. I have taken backup of list X and I want the same backup to be restored as list Y. both lists are on same site. I need both lists with same data but different URI.

    Is it possible?? If yes how?

  22. Kaitlyn says:

    I've been doing restores in our Dev environment for testing purposes. We have site collection search scopes that keep disappearing and we couldn't figure out why.

    Found out that my backup files were not including the site collection search scopes, so everytime we restore a site.. I have to go in and recreate. Is this working as designed or am I missing something?

    Any help would be awesome!

  23. Raghav Mahajan says:

    How to import the template in SharePoint Online (O365) ?