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
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:
· 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
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.
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.
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.
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.
Are workflows and alerts included in the import and export of a site or list?
Joel
No unfortunately, they aren't included in the export/import operation.
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?
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.
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!
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.
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,
@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
Are page layouts, content types, publishing pages and publishing content areas are included in the import and export of a site?
@Abhijiy Sil: yes all will come with u but ofcourse except any deployed custom development, u will have to deploy it again..
Mai Omar Desouki
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..
Directory \\backup\SharePoint 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.
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.
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
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!