Backing Up and Restoring Web Sites
|Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
With Microsoft , you can back up and restore individual Web sites hosted on your server or server farm. You can use this backup and restore method to replace a site that has become corrupted, or that contains changes that need to be rolled back. This backup and restore method is not dependent on the type of database you are using. You can perform this backup and restore method even if you are running Microsoft SQL Server 2000 Desktop Engine (Windows) (WMSDE) instead of Microsoft SQL Server 2000.
Caution: Previous versions of this guide recommended using regular backup operations to allow recovery of single document or list items. This usage is no longer recommended. Because the backup operation involves reading a large amount of data, running the backup process frequently can interfere with the performance of the system, including blocking end users' access to their sites. If you need a solution for quick recovery of deleted documents or list items, you might want to consider creating a recycle bin by using the Windows SharePoint Services object model. For more information about using the object model to create a recycle bin, see the Add a Recycle Bin to Windows SharePoint Services for Easy Document Recovery article on the MSDN Web site.
If you need to back up a specific site, rather than a whole installation of , you can do so by using the backup and restore operations with the Stsadm.exe command-line tool. You do not need SQL Server 2000 to perform a site-by-site backup. If you are using WMSDE, this is the only backup and restore option that is available.
When you back up a Web site, you back up the content database for the site, including all pages in the site, files in document libraries or lists, security and permission settings, and feature settings. The backup process creates a single file that contains all of this data. You can then restore your site to either the same location or to a new location. You can back up only top-level Web sites, not individual subsites. The backup file for a top-level Web site includes any subsites of that site.
You must be a member of the server computer's administrators group or a member of the SharePoint administrators group to be able to back up or restore a site.
About Site Backup and Restore
Site backup and restore is intended to help you reconnect sites that have become corrupted or need to be restored to a previous state. This process is not intended for moving a site to a new server. If you want to move a site, use the Microsoft SharePoint Migration Tool (smigrate.exe) instead. For more information, see Migrating and Upgrading Web Sites .
When using site backup and restore, keep the following items in mind:
You can automate the backup process by using a batch file, a script, or the Scheduled Tasks item on Microsoft Windows Control Panel.
You can use the object model to include the backup operation in a scripted procedure. For more information, see the .
Site backup and restore affects performance and can cause access errors.
The process of backing up and restoring sites takes up both memory and processing power on your server. In addition, if you have many sites, or a large amount of data in your sites, the backup process can take a long time, and might result in access errors for your users. If you choose to schedule automatic backups in a batch file or script, be sure to run the backup process when server usage is minimal or, optimally, when there are no users accessing data on your sites.
Site backup and restore are not designed to be used when the server is under active load.
If a site is in use when the backup operation is run, the data in that site may continue to change throughout the operation. The resulting backup file may be inconsistent with the actual state of the site and, if you restore this file, the restored site or database will be inconsistent as well.
Sites with duplicate names cannot not be restored.
This could be a problem in the following situation. If you have two virtual servers, with separate content databases for each virtual server that are only listed by relative paths in the configuration database, the site names may conflict. For example, if the configuration database lists the site names without the http://server_name prefix, you could have several sites that use the same path. For example, http://server_1/sites/site1 and http://server_2/sites/site1 could both be listed in the configuration database as /sites/site1 even though they are on separate virtual servers. In this case, the sites will not be restored correctly, and you will see an error in the restore log file.
You must have the appropriate language packs installed to successfully restore a site.
If a site you are restoring to a new server used a specific language pack, you must add the language pack to the new server before restoring the site or update the new server with the language pack after you restore. If you do not add the language pack, users who browse to the site or any subsites will see a "file not found" error.
Restoring Sites in Active Directory Account Creation Mode
When restoring a site that was running in Active Directory account creation mode, the destination site must also be running in Active Directory account creation mode.Further, you cannot restore a site that was not running in Active Directory account creation mode to a server that is running in Active Directory account creation mode.
Do not run the both the original and the restored sites simultaneously. Doing so creates security risks as it allows users from the backup site to have full access to the restored site, and all user management changes to one site will apply to the other site.
When deleting either the original or restored site, make sure that you specify the -deleteusers false option on the stsadm.exe command line or users from both sites will be deleted from Active Directory service. For example:
stsadm o deletesites deleteusers false
Using the Backup Operation
To back up a site, you use the backup operation with the Stsadm.exe command-line tool. The backup operation takes the following parameters.
Backup filename. For example, backup.dat.
Web site URL. For example, http://server_name/site.
Overwrite any existing backup file or Web site. By default, the backup operation does not overwrite files. If you do not specify this parameter and a backup file or Web site exists, the operation will stop.
The filename parameter can take any of the following types of information:
A filename, such as backup.dat
A path on the local hard disk, such as c:\backups\backup.dat
A path on a network share, such as \\share\folder\backup.dat
Note: Before you run the backup operation, you may want to list all of your sites and identify which sites to back up. To see a list of sites on your server, you can use the enumsites operation. Listing the sites with enumsites can be useful when you are automating backups. You can include enumsites in your batch file, parse the list of sites, and then walk through the list of sites to create the backups. The enumsites operation uses the following syntax:
stsadm.exe -o enumsites -url <url>
To perform a simple backup of a site, you would use syntax similar to the following:
stsadm.exe -o backup -url http://server_name/site -filename backup.dat
To back up a site and overwrite an existing backup file, you would use syntax similar to the following:
stsadm.exe -o backup -url http://server_name/site -filename c:\backups\backup.dat -overwrite
Using the Restore Operation
To restore a site, you use the restore operation with the Stsadm.exe command-line tool. The restore operation takes the same parameters as the backup operation: filename , url , and overwrite .
You have three options for restoring sites from a backup.
You can restore a site over an existing site.
Use this option with caution. When you overwrite an existing site, the existing site is completely overwritten. You cannot merge sites. Any existing site content, and existing site permissions, are destroyed when you overwrite a site.
You can restore a site to a new site on the same server.
This is the recommended option. When you restore a site to a new site on the same server, you can copy the data from the restored site, and paste it back into the original site. Use this method if you are restoring a site to recover data.
Note: In order for the restore operation to work correctly, the included and excluded paths for your virtual server must be configured properly. If you are restoring a site to a new site, be sure to create an included path for the site, if necessary, before restoring the site.
You can restore a site to a separate server, with a separate installation of that uses a copy of the original server's configuration database.This is a more complicated scenario, but it gives you the ability to set up two versions of the same site, as in the previous option, but with the ability to use the unused Web site deletion feature to remove the site automatically after a specific time period. For more information about automatically deleting unused Web sites, see Managing Unused Web Sites .
Note: If you are trying to recover a particular list or list item from a site backup, use this method to restore the site, and then copy the list or item from the restored site back to the original site.
To restore a site from a backup file, either to a new site or a separate server, you would use syntax similar to the following:
stsadm.exe -o restore -url http://server_name/site -filename backup.dat
To restore a site from a backup file on a server share, and to overwrite any existing site at the new location, you would use syntax similar to the following:
stsadm.exe -o restore -url http://server_name/site -filename \\share\folder\backup.dat -overwrite
About GUIDs and Restoring Site Collections
If you attempt to restore a backup of a site collection more than once to the same content database, you may get the following error message: "No content databases are available for restoring this site collection. Create a new content database and then try the restore operation again." This is because the globally-unique identifiers (GUID) for lists are preserved in the backup file and reused during restore, but the content database requires list GUIDs to be unique. Therefore, you cannot restore a site collection twice to the same content database, and must instead use a different content database.