Tuesday, October 15, 2013

How to recover a specific site from an unattached content database backup


This posting walks through the process of recovering a specific site from an unattached database backup, step-by-step.  This procedure is performed on a SharePoint Server 2010 farm.  The operating systems for all servers is Windows Server 2008 R2, and the farm data tier is hosted on SQL Server 2008 R2. This procedure employs the following tools: SQL Server Management Studio, SharePoint 2010 Central Administration and PowerShell 2.0.

Step 1: Restore the content database to the SQL Server instance
  1. Copy the content database backup file to the SQL Server host machine:
  2. Launch SQL Server Management Studio:
  3. Expand the console tree to display the Databases folder.
  4. Right-click on the Databases folder.  A popup menu appears:
  5. Select Restore Database from this menu.  The Restore Database dialog appears:
  6. In the Destination for restore section of this dialog, in the To database, field, enter a name that you want to give the restored database.  For this procedure, Demo was entered.
  7. In the Source for restore section, select From device, and then click the ellipsis button.  The Specify Backup dialog appears:
  8. Click the Add button.  The Locate Backup File dialog appears:
  9. Expand the tree to find the content database, and then select it.
  10. Click OK.  The Locate Backup File dialog closes, the focus is returned to the Specify Backup dialog, the selected backup file now being listed:
  11. Click OK.  The Specify Backup dialog closes, and the focus returns to the Restore Database dialog, with the database listed:
  12. Click OK.  A progress indicator appears momentarily, and then the dialog closes.  The newly restored database now appears in the Databases folder:
  13. This completes restoration of the content database.
Step 2: Export the site from the content database backup
  1. Launch Central Administration.
  2. In the Central Administration Quick Launch, click Backup and Restore.  The browser is navigated to the Backup and Restore administration page:
  3. In the Granular Backup section, click Recover data from an unattached content database.  The browser is navigated to the Unattached Content Database Data Recovery page:
  4. On this page, the Database Server name should already be entered.  Enter the Database Name.  This should be the same name that appeared in the Databases folder, after successfully completing the restore process.
  5. In the Operation to Perform section, select Browse Content, and then click Next.  The browser is navigated to the Browse content page:
  6. In the Site Collection section, select the appropriate site collection and site from the dropdowns:.
  7. In the Operation to Perform section, select Export site or list:
  8. Click Next.  The browser is navigated to the Site Or List Export page:
  9. In the File location section, enter the desired path and filename:.
  10. Click Start Backup.  The browser will be navigated to the Granular Backup Job Status page:
  11. This page refreshes automatically after a few moments.  Once the backup file has been successfully created, this status will be displayed in the Site Collection Backup section.  This will create a file with ending CMP.
  12. Verify that the site backup was created:
  13. This completes export of the site from the content database backup.
Step 3: Create a new blank website
  1. Open a browser, and then navigate to the web application to which site backup will be restored.
  2. Navigate to the root site collection or subsite to which the site backup will be restored.
  3. From the Site Actions dropdown, select New Site.  The Create popup dialog appears, filtered to display new site templates available:
  4. Select the Blank Site template.  Then, in the configuration panel at right, enter a name for the new site and the name for the site that will become its URL:
  5. Click Create.  A progress indicator appears momentarily, and then closes.  The browser is then navigated to the new site:
  6. This completes creation of a new blank site.
Step 4: Import the site
  1. Logon to the machine hosting the farm Central Administration application.
  2. Launch the SharePoint 2010 Management Shell.
  3. Test the import by running the import using the WhatIf condition:
    Import-SPWeb -Identity http://spdev12/jVectorMap -Path C:\jvectormap.cmp  -Force -Verbose -WhatIf
  4. Run the import script using the Verbose condition.  Doing so will display any minor warnings or errors generated during the import:
    Import-SPWeb -Identity http://spdev12/jVectorMap -Path C:\jvectormap.cmp  -Force -Verbose
  5. Otherwise, some errors may be missed:
  6. Checking the import log file revealed a minor error importing one of the files - a file that is prohibited from being uploaded by default policy:
  7. Open a browser, and then navigate to the new site.  The contents of the new site should now appear:
  8. This completes this procedure.

This posting has presented a step-by-step walkthrough for how to restore a specific site from an unattached content database backup.

  • "Unattached" in this instance means that the database is not attached to the farm.  It has nothing to do with whether it is attached to the SQL Server instance.

No comments: