Our KB article on backing up Microsoft SharePoint describes three different strategies for backing up SharePoint: direct SQL-level backups, SQL-level backups using the SQL Server backup tools, and backups using the stsadm SharePoint tool. The restore process depends on which backup strategy was used.
Another factor to consider is whether or not you need to restore the configuration database. This is necessary if information in the configuration database is not synchronized with how your SharePoint farm is actually configured. This can happen if you are restoring to a different SharePoint server other than the one where you backed up the data, or if you move content databases manually or forget to issue the stsadm command, preparetomove, etc. If you do need to restore your farm onto a different farm or a farm with a different topology, or for other reasons described above, see the procedures in the TechNet article, Restore a farm after a configuration database problem.
Also, unless you are using the direct SQL-level backup method, you cannot restore the configuration database (this restriction does apply to SQL-level backups using the SQL Server backup tools). The reason is that methods other than the direct SQL-level backup method only capture one database at a time instead of a consistent point in time snapshot of all databases. The direct SQL-level backup method does capture a single point-in-time image of all of your databases (even if they are across multiple volumes, as long as all volumes are part of the backup), and this is why this limitation does not apply to direct SQL-level backups. If you need to manually recreate the configuration database and Central Administration content database, this can be done using the SharePoint Products and Technologies Configuration Wizard or the psconfig tool. More information is also available in the TechNet article, Prepare to back up and restore a farm. See also Microsoft KB article 948725.
Restore instructions for SQL-level backups
Use the instructions in this section if you backed up the SharePoint SQL server databases by directly backing up the database files (.MDF, .LDF, and .NDF).
- Stop all SQL Server, IIS, and SharePoint services.
- Start the backup manager, go to the Control Panel page, and click the File Manager button.
- Login to the file manager. Choose to restore all database files (either to their original locations or an alternate location; if you have existing files, we highly recommend choosing to move existing files to an alternate directory during the restore).
- Also, if you chose to backup the search indexes, be sure to also restore these files at this time as well (to their original locations).
- Use the SQL Server management tools to re-attach to the restored database files. See our KB article on restoring SQL Server databases for more detailed instructions.
- Restart all services stopped in step 1.
- If you chose not to backup the search index, then you must clear your search index and recrawl the content. To do this, open Central Administration, select the appropriate Shared Services Provider (SSP) from the navigation menu, underneath the search header, choose Search Settings. Then click Reset all crawled content and then go to Content sources and crawl schedules, which will allow you to initiate a full crawl.
Note that if you only want to restore certain items from your content databases, then you can restore the .MDF, .LDF, and .NDF files for your content databases to an alternate location and attach them as a different database name in SQL server. You can then create a recovery farm and attach the restored content database to the recovery farm, where you can restore your specific items from there.
Restore instructions for SQL-level backups performed using SQL Server backup tools
Use the instructions in this section if you backed up the SharePoint SQL server databases by using the SQL Server backup tools. We also recommend reading the TechNet article, Restore a farm by using SQL Server tools. With this technique you can restore content databases, databases for Shared Service Providers (SSPs), search databases, and search databases for SSPs. Also, you can restore the Central Administration content database and Configuration database, but only if you are restoring to a server with exactly the same environment as the one where the data was backed up, including the same SharePoint verion, server names, server roles, etc.
- Shut down all SharePoint and IIS services. Wait a few minutes for all SharePoint stored procedures to finish (especially if you have a busy SharePoint site)
- Use the file manager to download and restore the backup files generated by the SQL Server backup tools.
- If you want to preserve changes since your last and if you have complete and intact transaction logs since your last full backup, you can optionally backup your live transaction logs (using SQL Server management tools), and then once you restore the database(s) from your last full backup, you can then additional restore your transaction log backups to roll forward as far as possible. If you are performing a point in time restore or if your live databases are corrupt or not available, this optional step is not applicable.
- Start SQL Server Management Studio and connect to the appropriate server.
- Locate and right click the database you want to restore and choose the Tasks, Restore, Database command.
- On this dialog specify the backup source and restore destination (defaults are usually fine), and select the full backup to restore from (that you downloaded in step 2).
- On the Select a page area, choose Options, and within the Restore options section, check the Overwrite the existing databaseoption (typically you want to leave other settings in this section unchecked).
- If you chose to backup additional transaction logs in step 3, then choose Restore with NORECOVERY for Recovery state. Otherwise choose Restore with Recovery.
- Click OK and the restore will begin for this database.
- Repeat steps 5 through 9 for every database that you want to restore.
- Restart the SharePoint and IIS services.
- You must clear your search index and recrawl the content. To do this, open Central Administration, select the appropriate Shared Services Provider (SSP) from the navigation menu, underneath the search header, choose Search Settings. Then click Reset all crawled content and then go to Content sources and crawl schedules, which will allow you to initiate a full crawl.
For more information on how to restore databases using the SQL server management tools, refer to the topic on backing up and restoring databases in the SQL Server documentation.
Restore instructions for backups generated by the stsadm tool
Use the instructions in this section if you had backed up SharePoint using the stsadm tool. We also highly recommend reading the TechNet articles, Restore a farm using built-in tools and Restore a farm by using the stsadm command-line tool. Note that restoring from one version of SharePoint to a different version is not supported. If you do not restore the entire SSP node, then search may take several minutes (or even longer for large sites) because the search index will have to be rebuilt (partially or fully).
- Open the backup manager, go to the Control Panel page, and start the file manager. Use the file manager to restore all backup files to a restore directory (in our examples, we'll be using E:\SharePointBackups).
- Open a command prompt and execute the following commands:
cd %COMMONPROGRAMFILES%\Microsoft Shared\Web Server Extensions\12\Bin
stsadm -o backuphistory -directory E:\SharePointBackups
Â Â Â (if you restored the backup files to a different directory, be sure to specify that instead after the -directory argument)
This will list the GUIDs of all items available in the specified directory.
- Choose an item to restore from the list generated by the previous step and find the corresponding GUID of that item (also in the output of the previous command). Then, in the command prompt, execute:
stsadm -o restore -directory E:\SharePointBackups -backupid GUID -restoremethod overwrite
NOTE: This will overwrite any existing data in SharePoint for the item you are restoring. Other restore methods are available, see documentation on the stsadm restore operation.
- Follow the steps and prompts as the command in step 3 executes (confirm when it asks you if you are sure you want to overwrite files, and you may be asked to enter credentials to connect to the web application or content database).
- When the command finishes it will tell you how many warnings and errors were encountered. Refer to the sprestore.log file for detailed information if there are any errors or warnings.
- TechNet: Prepare to backup and restore a farm.
- TechNet: Back up and restore Web applications.
- TechNet: Back up and restore site collections.
- TechNet: Back up and restore SharePoint databases.
- TechNet: Back up and restore SSPs.
- TechNet: Back up and restore SSO.
- TechNet: Back up and restore My Sites.
- TechNet: Back up and recover site objects.