Friday, February 13, 2015

How to recover (restore) individual items for Sharepoint when the Granular Recovery Technology (GRT) option is not used during the backup of Sharepoint resources

Description – This document will describe how to use a full Sharepoint Content database backup to recover granular items when the Granular Restore Technology (GRT) functionality is not available.  This process provides the ability to restore a list, library, site, or site collection back to its original location within the production Sharepoint environment.  If only a single document, file, or list item is desired for restore, the entire list or library housing that item must be restored.
Environment – This process is applicable to Sharepoint 2010 and 2013, and Backup Exec versions 2010 R3 and later where the ability to redirect the restore of a Sharepoint Content database to a SQL server is present.  Step by step instructions below are based on the Backup Exec 2012 interface.
Assumption – This procedure assumes that successful backups of the Sharepoint content databases has been performed using the Backup Exec Sharepoint agent.  It is not necessary to have had GRT enabled for the Sharepoint backups.

Part I – Steps for Restoring the Content Database with Backup Exec

The first part of this process involves performing a restore of the backed up Sharepoint Web Application content database that the granular content resides in that is desired.  Use the following steps to perform this restore:
1) Highlight the Sharepoint farm resource in the Servers list in Backup Exec then click Restore.
2) The next screen shows the Microsoft Sharepoint Server data selection.  Click Next.
3) Highlight the Sharepoint web applications or portal sites selection and click Next.
4) In the next screen, first set the appropriate date range at the top for the backups desired to restore.
a. Expand the resources displayed in the Resource View and locate the desired Web Application name to restore.
b. Expand the selected Web Application to display the backup sets available for restore and checkbox the backup date needed.  Click Next.
5) In this screen the target location for restore is selected.  For this process, select To an alternate SQL instance.
6) Enter the SQL server and instance (if applicable) names in the first line.  If a new database name is desired for the restored database, enter it in the second line.  If the credentials required for this SQL server are different from those used for the original Sharepoint backup, supply a Server logon account.  Click Next.
NOTE:  The SQL server target must be the same or a later build of SQL server as original. If restoring to the same SQL server instance as the production databases, a new database name must be supplied.
7) Select whether to overwrite an existing database and click Next.
8) Select any other parameters for the restore job and click Next.
9) Enter a name for the job if desired and set the scheduling parameters.  Click Next.
10) Note the Restore Summary for all job settings and click Finish.
The restore job will restore the selected database to the selected SQL server.  Depending on the size of the database, this may take some time.
NOTE: This is the end of the steps to be accomplished with Backup Exec.  The rest of the process involves steps performed with Microsoft Sharepoint utilities.  Any questions or issues arising with those utilities should be addressed with Microsoft documentation and support.

Part II – Exporting data from the unattached Content Database

The second part of this recovery process involves using the Sharepoint Central Admin Backup and Restore utility to export the desired data from the content database.  These steps were obtained from Microsoft TechNet Library article Restore content from unattached content databases in SharePoint 2013,
These are the steps to be performed from within Sharepoint Central Administration on the Sharepoint server.
1) Verify that the user account that is logged in to perform this procedure is a member of the Farm Administrators group in Sharepoint and is a member of the db_owner fixed database role in SQL.
2) Start SharePoint Central Administration..
3) In Central Administration, on the home page, click Backup and Restore.
4) On the Backup and Restore page, in the Granular Backup section, click Recover data from an unattached content database.
5) On the Unattached Content Database Data Recovery page, type the database server name in the Database Server text box and type the database name in the Database Name text box.
6) Select the database authentication method that you want to use.
7) Select the Browse content option, and then click Next.
8) On the Browse content page, select the site collection, site, and or list that you want to restore, select the Backup site collection or Export site or list option, and then click Next.
9) Supply a UNC path to a shared directory along with a filename with *.cmp extension to export the data to.
10) Select whether to export security and/or versioning and click Start Export.
Note:  Further details about the export process are available from Microsoft Document

Part III – Importing data back into the Production Content Database

This third part of the process involves using the Microsoft Sharepoint Management Shell to import the content that was exported in Part III above.  Detailed information about this process is available in the Microsoft TechNet Library document Import a list or document library in SharePoint 2013 ,
Using the following steps will import everything exported in the steps above.  You cannot import only a subset of what was exported.
1) Verify that you have the following memberships:
   - securityadmin fixed server role on the SQL Server instance.
   - db_owner fixed database role on all databases that are to be updated.
   - Administrators group on the server on which you are running the Windows PowerShell cmdlets.
Note: An administrator can use the Add-SPShellAdmin powershell cmdlet to grant permissions to use SharePoint 2013 Products cmdlets.  See Microsoft documentation for the Add-SPShellAdmin powershell command,
2) On the Start menu, click All Programs.
3) Click Microsoft SharePoint 2013 Products.
4) Click SharePoint 2013 Management Shell.
5) At the Windows PowerShell command prompt (that is, PS C:\>), type the following command, and then press ENTER:

Import-SPWeb -Identity -Path [-Force] [-NoFileCompression] [-Verbose]
The site or subsite that you are importing must have a template that matches the template of the site specified by Identity.
With this operation complete, the data exported from the restored content database should be restored back into the production Sharepoint environment.

Sharepoint content Export/Import Example

Sharepoint environment setup: This example will describe exporting a document library called ‘New Docs’ from a Subsite called ‘Doc Space’ under a site called ‘Site B’ within a Site Collection called ‘SPV4’.  It is important to know the URL of where the document library of interest exists and what its URL was/is.  In this case we have the following URL for this library, http://spv4/siteb/docspace/new docs
Data to export: The basic document library being exported was created and 4 files uploaded to it.  The export process will export the entire document library to be used to recover a single file that will be deleted.  Since only the full document library can be exported/imported, these steps will also illustrate that importing the whole document library will not delete any data already present.
Content DB backup, doc deletion, and restore: The Sharepoint content database for the example Web Application has been backed up with Backup Exec then one of the files present in the 'New Docs' document library has been deleted from within Sharepoint. This document is also deleted from the library recycle bin.  In this example, the Content database is called WSS_Content and is in a SQL server called SPV4\SHAREPOINT where SHAREPOINT is the named instance.  The content database has now been restored to the same SQL server as a new database named WSS_Content_Restore.  At this point in the example, the ‘live’ database is missing one of the documents from the document library.  The restored, unattached content DB still has that document present.
        Environment Summary:
URL for document library – http://spv4/siteb/docspace/new docs
Database Server name – SPV4\SHAREPOINT
Restored content DB name – WSS_Content_Restore

Exporting the document library steps:
1) Open Sharepoint Central Admin then click on Backup and Restore2) In the Granular Backup section, click Recover data from an unattached content database.
3) In the Database Server blank, enter the name of the SQL server housing the unattached content DB, SPV4\SHAREPOINT.
4) In the Database Name blank, enter the name of the restored content DB, WSS_Content_Restore.
5) Select the Export site or list radio button then click Next.
6) In the next screen, using the dropdowns, Select the /siteb/docspace subsite and the New Docs document library.
Note that the site collection URL shown will look different than original with a different port number, this is normal.  The Site Collection names, site names, and list/library names will correspond to original, however.
7) Enter a UNC path to a shared folder where the export file can be created.  Be sure that the account being used has rights in that file location.   The \\SPV4\Exports folder was created and shared in Windows Explorer, and \\SPV4\Exports\newdocs.cmp was entered in the file path.
8) Choose whether to export security and which versions to export for libraries/lists with versioning enabled.  In this example, it was selected to Export full security and All Versions were selected  Click Start Export.
9) The steps so far have resulted in a file called newdocs.cmp created containing the exported document library.  The next steps will import this library into the production content DB to replace a document that was deleted.
Importing the document library steps:
1) Open Sharepoint Management Shell
2) Used the following command to import the New Docs library to the docspace subsite:
Import-SPWeb –Identity http://spvr/siteb/docspace -Path \\bldbspsv4\exports\newdocs.cmp
Note that there are other optional parameters available for the import command that were not used in this example.  See Microsoft documentation for details.

Viewing the document library after the restore completed showed that all 4 documents are once again present.  Also note that the newly restored document shows ‘NEW’ and the other 3 documents show that they were modified at the time of the import job.

No comments:

Post a Comment