If a document is lost or overwritten, do you know how to recover it? Even more importantly – if it’s business critical, how quickly can you get it back? In this blog post, we’ll examine six different ways to recover lost content in SharePoint 2010, starting with the quickest way and ending with the most time-consuming method.
||Quickest Way: Restore a Previous Version
Method #1: Restore to a Prior Document Version
If versioning is turned on in the document library, then you’ll be able to revert to a past version of a document in no time. In SharePoint 2010 libraries, there are three version options:
(1) No Versioning
(2) Major Versioning (whole numbers assigned to document versions, 1.0, 2.0, 3.0, etc.)
(3) Minor Versioning (whole number with a decimal, example, 1.1, 1.2, 1.3, etc.)
To configure versioning
(1) Navigate to the library in SharePoint.
(2) In the ribbon, under the Library Tools group > Library tab, click the Library Settings button.
(3) Under the General Settings heading, select Versioning settings.
(4) On the next screen, select a versioning option and optionally limit the number of versions to retain.
When satisfied with this screen, click OK to save the settings. For more information on document versioning, see Enable and configure versioning for a library, http://office.microsoft.com/en-us/sharepoint-foundation-help/enable-and-configure-versioning-for-a-library-HA101853103.aspx.
Assuming versioning is enabled in a library, it is possible to roll-back to an older version of a document. For example, if a user accidentally overwrites a document, you can restore a previous version and recover the document.
To revert to a previous document version
(1) Check out the document, for example:
Note: For complete instructions on checking out a document, see Check out a file, http://office.microsoft.com/en-us/sharepoint-foundation-help/check-out-check-in-or-discard-changes-to-files-in-a-site-library-HA101849698.aspx?CTT=3#_Toc258239254.
(2) Click OK when asked to confirm.
(3) Next, click the down-arrow to the right of the document title and choose version history.
Version history is displayed.
(4) Select the version you want to restore.
(5) Click OK when asked to confirm.
The version you restore becomes the latest version.
(6) Remember to check in the document when done.
For more information on using document versions, including how to restore or delete previous versions, read the following articles:
||Fairly Quick: Restore a Recycle Bin
Method #2: Restore from the Recycle Bin
In order to provide maximum recoverability, SharePoint has two (2) recycle bins:
- Stage One Recycle Bin – When a user deletes a document, SharePoint sends it to the First Stage Recycle Bin, where it remains for the number of days set by the SharePoint Administrator (default is 30 days). This the End User Recycle Bin. After the allotted time has passed, SharePoint moves the document to the Stage Two Recycle Bin.
- Stage Two Recycle Bin – This is the Site Collection Recycle Bin. Only a site collection administrator can restore items from the second stage recycle bin. Important Note: If an entire site is deleted, SharePoint sends it to the Stage Two Recycle Bin, provided Service Pack 1 has been loaded. If your SharePoint farm is not running SP1, you will need to restore the site from an unattached content database (explained later) or a full farm backup.
Stage One Recycle Bin
To restore an item from the Stage One Recycle Bin
(1) Navigate to the site of the item that needs to be restored.
(2)Select the Recycle Bin option, typically shown on the left side of the screen in the Quick Launch area.
A list of items that have been deleted is displayed.
(3) When you find the deleted item, select the checkbox to the left of the name and click the Restore Selection link.
SharePoint removes the item from the recycle bin. If you cannot find the item in the Stage One Recycle Bin, check the stage two (Site Collection) recycle bin.
Stage Two Recycle Bin
To restore an item from the Stage Two Recycle Bin
(1)On the top-level site, click the Site Actions menu and select Site Settings.
(2)On the Site Settings page, under the Site Collection Administration heading, click Recycle bin.
Two options appear on the left side of the screen: End user Recycle Bin items and Deleted from end user Recycle Bin.
(3) Select Deleted from end user Recycle bin.
(4) When you find the item to be restored, select the checkbox next to the item(s) and then click Restore Selection.
For more information on restoring from the recycle bin, read this article: http://office.microsoft.com/en-us/sharepoint-server-help/restore-a-deleted-object-from-a-sharepoint-recycle-bin-HA102655219.aspx#_Toc294595527.
Recycle Bin Configuration
To configure recycle bin settings
SharePoint Farm Administrators can configure recycle bins in Central Administration differently for each web application. By default, Recycle Bins are turned on in all the site collections in a Web application and set to 30 days for stage one recycle bin, with items remaining in the stage two recycle bin until a percentage quota is reached. This article describes how to configure Recycle Bin settings for a Web application:
Why would an item NOT appear in a recycle bin?
- Were you the one who originally deleted the item? The recycle bin is limited to documents, items, lists and libraries that you have deleted and not someone else. You cannot see content deleted by other users.
- Was the document originally in a folder that was also deleted? You cannot restore an item that was in some sort of a container (i.e., a library or a folder) if the container has been deleted. First, restore the container, and then you can restore the item.
Note: In the Stage Two Recycle Bin (i.e., the Site Collection Recycle Bin), all contents are shown, regardless of who deleted them. However, you must have Site Collection Administrator rights to access this recycle bin.
||Very Quick if You’re Comfortable with PowerShell: Use a Script to Restore Deleted Items, Sites, Site Collection
Method #3: Use PowerShell
To use PowerShell to restore an item from the recycle bin, first find the item’s GUID. The basic procedure is to use the RecycleBin.Restore property of SPWeb. See script here: http://maplpro.blogspot.com/2010/03/how-to-restore-from-sharepoint-2010.html.
Although PowerShell is optional in many situations, to restore an entire site collection requires PowerShell. Note that this only works if SP1 has been loaded.
The command, as explained in Microsoft TechNet, is as follows:
Restore-SPDeletedSite [-Identity] <SPDeletedSitePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-ContentDatabase <SPContentDatabasePipeBind>] [-WebApplication <SPWebApplicationPipeBind>] [-WhatIf [<SwitchParameter>]]
See http://technet.microsoft.com/en-us/library/hh286319(v=office.14).aspx for complete instructions.
|Not Fast, but Easier than Restoring the Farm: Recover Data from Unattached Database
Method #4: Restore from an Unattached Content Database
SharePoint 2010 provides a really useful feature: If you have a backup of the content database, you can restore it somewhere and browse its contents from inside Central Administration.
Note: This method may not work if the content database was using a different version of SharePoint. It definitely will not work if the content database was using SharePoint prior to SP1, and the current version of SharePoint is on SP1 or later, as SP1 alters the schema of all content databases.
Also note that SharePoint uses the Farm Account to log into the database. If the Farm Account does not have access to the database, this method will not work.
To restore from an unattached content database
(1) In Central Administration, select Backup and Restore.
(2) Under Granular Backup, choose Recover data from an unattached content database.
On the next screen, enter the database server name and database name. Choose the authentication (Windows or SQL – if SQL, enter account name and password), and then select an operation: Browse content, Backup site collection, or Export site or list.
(3) Click Next.
On this screen, you can select the site collection, site, list, and operation (backup or export).
(4) Optionally select a different Site Collection, Site, or List by clicking the drop-down. Choose Backup site collection or Export site or list, and click Next.
In this scenario, we will assume you selected Export.
(5) On the next screen, for filename, provide a UNC path plus a filename with *.cmp extension (this is the typical extension SharePoint uses for exports). Optionally select Overwrite existing files and/or Export full security. For the Export versions, you can select All Versions, Last Major, Current Version, or Last Major and Last Minor.
(6) Click Start Export to begin the export process.
SharePoint shows export progress on the screen. Periodically click Refresh to force the screen to update. If the export succeeds, a Succeeded message displays across from Previous Job.
In the path provided earlier, you will find two files, the exported data (*.cmp) and a log file, example:
To import this data into SharePoint, use the PowerShell command Import-SPWeb as explained here: http://msdn.microsoft.com/en-us/library/ff607613.aspx. Example:
Import-SPWeb http://intranet.sharepoint.com/somesubsite/anothersite –Path export.cmp –IncludeUserSecurity –UpdateVersions Overwrite
For more information about restoring from an unattached database, see this article:
|Not Fast, but May Be Preferable for Users: Restore to an Alternate Farm
Method #5: Restore to an Alternate Farm
For various reasons, it may be preferable to restore to alternate farm and allow the users to view the content and determine what needs to be restored. Of course to use this option, you will need an alternate farm (usually Test), or you may be able to restore to a VM – possibly a developer’s machine. In any case, the alternate farm needs to be on the same version as SharePoint, ideally with all patches and language packs the same.
To restore to an alternate farm
- Retrieve the backup. You can backup a farm in PowerShell, Central Administration, and by using SQL Server tools (see http://technet.microsoft.com/en-us/library/ee428316(v=office.14).aspx).
- Restore the backup on the alternate farm. See http://technet.microsoft.com/en-us/library/ee428314(v=office.14).aspx.
- Create a new site collection that points to the content database. The PowerShell command to target a specific database is explained here: http://www.sharepointassist.com/2011/02/19/creating-one-content-database-per-site-collection-in-sharepoint-2010-using-windows-powershell. Example:
New-SPSite -name “TempSite” -ContentDatabase WSS_Content_Temp-url http://intranet.sharepoint.com/Temp/ -OwnerAlias “mydomain\accountname”
Alternatively, you can create a temporary web application / site collection first, drop the existing database, and then use the “Mount” PowerShell command as explained here: http://technet.microsoft.com/en-us/library/ff628582.aspx.
Mount-SPContentDatabase “WSS_Content_Temp” -DatabaseServer “SomeServer” -WebApplication http://temp
Method #6: Restore the Farm from a Backup
Restoring the entire farm is usually only necessary after the entire farm fails, when it is impossible to restore only part of the farm. If you must restore the entire farm, first make sure SharePoint is on the same version. If SharePoint must be re-loaded, then re-apply all language packs, cumulative updates, and service packs. Likewise, if you had a three-tier farm, then make sure all tiers are available; you cannot restore a multiple-server farm to a single-server, stand-alone farm and vice versa. For detailed instructions, see http://technet.microsoft.com/en-us/library/ee428314(v=office.14).aspx.
Also, when using SQL Server tools to restore, the Configuration and Central Administration databases may be backed and restored, but they cannot be restored using SQL Server. See this article for instructions: http://technet.microsoft.com/en-us/library/cc512725(v=office.14).aspx. Additionally the search index is not stored in SQL Server, so you must perform a full crawl after the restore.