Restore a content database (Search Server 2010)

 

Applies to: Search Server 2010

Topic Last Modified: 2011-08-05

You can restore any content database or several content databases, one at a time. For information about how to restore all the content databases in a farm at the same time, see Restore a farm (Search Server 2010).

Procedures in this task:

  • To restore a content database by using Windows PowerShell

  • To restore a content database by using Central Administration

  • To restore a content database by using SQL Server

Task requirements

Consider the following information before you restore a content database:

  • If you are using a recovery farm, it must have the same topology as the source farm.

  • You cannot restore a multiple-server farm to a single-server recovery farm or a single-server farm to a multiple-server recovery farm.

  • You cannot back up from one version of Microsoft Search Server 2010 and restore to another version of Search Server 2010.

  • A recovery farm is not intended to be a live farm. It is a farm that is only used to restore data. The recovery farm does not have to have the same hardware as the primary farm; we recommend that you use a stand-alone installation or a virtual farm.

Use Windows PowerShell to restore a content database

You can use Windows PowerShell to restore a content database.

To restore a content database by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. In the SharePoint Management Shell, at the Windows PowerShell command prompt, type the following command:

    Restore-SPFarm -Directory <BackupFolder> -RestoreMethod <Option> -Item <ContentDatabaseName> -BackupId <GUID> -Verbose
    

    Where:

    • <BackupFolder> is the path of the backup folder that you want to use.

    • <Option> is one of the following:

      • Overwrite, to restore to the same farm.

      • New, to restore to a different farm such as a recovery farm.

    • <ContentDatabaseName> is the name of the content database that you want to restore.

    • <GUID> is the identity of the specific backup that you want to use.

      If you do not use the BackupId parameter, the most recent backup is used. To view a list of the backups, including their Backup IDs, type the following command: Get-SPBackupHistory -Directory <BackupFolder>.

    Note

    If you are not logged on as the Farm account, you are prompted for the Farm account’s credentials.

    To view the progress of the operation, use the Verbose parameter. For more information, see Restore-SPFarm.

  3. If you do not use the Verbose parameter, the Command Prompt window displays no message if the operation succeeds. If the job does not finish successfully, the Command Prompt window displays an error message such as the following:

    Restore-SPFarm: The job failed. At line: <line> char:<column>. + Restore-SPFarm <<<< <Error Message>

  4. If there are errors or warnings, or if the job does not finish successfully, review the Sprestore.log file.

Use Central Administration to restore a content database

You can use Central Administration to restore a farm or components of a farm.

To restore a content database by using Central Administration

  1. Verify that the user account that is performing this procedure is a member of the Farm Administrators group.

  2. In Central Administration, on the Home page, in the Backup and Restore section, click Restore from a backup.

  3. On the Restore from Backup — Step 1 of 3: Select Backup to Restore page, from the list of backups, select the backup job that contains the content database backup, and then click Next.

    Note

    If the correct backup job does not appear, in the Current Directory Location text box, enter the Universal Naming Convention (UNC) path of the correct backup folder, and then click Refresh.

  4. On the Restore from Backup — Step 2 of 3: Select Component to Restore page, select the check box that is next to the content database, and then click Next.

    Note

    If the content database is not selectable, you must use Windows PowerShell or SQL Server tools to restore the content database.

  5. On the Restore from Backup — Step 3 of 3: Select Restore Options page, in the Restore Options section, select the Type of Restore option. Use the Same configuration setting. A dialog box appears that asks you to confirm the operation. Click OK.

    Click Start Restore.

  6. You can view the general status of all recovery jobs at the top of the Backup and Restore Job Status page in the Readiness section. You can view the status for the current recovery job in the lower part of the page in the Restore section. The status page updates every 30 seconds automatically. You can manually update the status details by clicking Refresh. Backup and recovery are Timer service jobs. Therefore, it may take several seconds for the recovery to start.

    If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page. You can also find more details in the Sprestore.log file at the UNC path that you specified in step 2.

Use SQL Server tools to restore a content database

You can use SQL Server tools to restore a content database by following these steps:

  1. If possible, back up the live transaction log of the content database to protect any changes that were made after the last full backup.

  2. Restore the last full database backup.

  3. Restore the most recent differential database backup that occurred after the most recent full database backup.

  4. Restore all transaction log backups that occurred after the most recent full or differential database backup.

To restore a content database by using SQL Server tools

  1. Verify that the user account that is performing this procedure is a member of the sysadmin fixed server role.

  2. If the Windows SharePoint Services Timer service is running, stop the service and wait for several minutes for any currently running stored procedures to finish. Do not restart the service until after you restore the content databases.

  3. Start SQL Server Management Studio and connect to the database server.

  4. In Object Explorer, expand Databases.

  5. Right-click the database that you want to restore, point to Tasks, point to Restore, and then click Database.

    The database is automatically taken offline during the recovery operation and cannot be accessed by other processes.

  6. In the Restore Database dialog box, specify the destination and the source, and then select the backup set or sets that you want to restore.

    The default values for destination and source are appropriate for most recovery scenarios.

  7. In the Select a page pane, click Options.

  8. In the Restore options section, select only Overwrite the existing database. Unless the environment or policies require otherwise, do not select the other options in this section.

  9. In the Recovery state section:

  10. Click OK to complete the recovery operation.

  11. Repeat steps 4 through 10 for each database that you are restoring.

  12. Start the Windows SharePoint Services Timer service.