![]() | |||||
![]() ![]() ![]() ![]() ![]() |
Use the Stsadm.exe command-line tool to backup or restore a site. The Stsadm.exe tool takes the following parameters.
Parameter | Required? | Description |
---|---|---|
-filename | Yes | Name of the backup file. For example, backup.dat |
-url | Yes | URL of the Web site. For example, http://server_name/site |
-overwrite | No | Overwrite any existing backup file or Web site. If you do not specify this parameter and a backup file or Web site exists, the backup stops. |
The -filename parameter can take any of the following types of information:
Note Before backing up sites, it is recommended that you generate a list of sites and identify which sites to back up. To generate a list of sites on your server, you can use the enumsites operation. Generating a list of sites by using the enumsites command can help when automating backups. For example, you can include enumsites in the batch file, parse the list of sites, and then use 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, use the following syntax:
stsadm.exe -o backup -url http://server_name/site -filename file_name.dat
To back up a site and overwrite an existing backup file, use the following syntax:
stsadm.exe -o backup -url http://server_name/site -filename local_drive:\path_name\file_name.dat -overwrite
To restore a site, you use the restore operation with the Stsadm.exe command-line tool. The restore operation takes the following parameters:
Parameter | Required? | Description |
---|---|---|
-filename | yes | Name of the backup file. For example, backup.dat |
-url | yes | URL of the Web site. For example, http://server_name/site |
-overwrite | no | Overwrite any existing backup file or Web site. If you do not specify this parameter and a backup file or Web site exists, the restore operation stops. |
You have three options for restoring sites from a backup.
Important 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.
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.
This is a more complicated scenario, but it allows you 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.
Note To recover a specific list or list item from a site backup, use this method to restore the site, 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, use the following syntax:
stsadm.exe -o restore -url http://server_name/site -filename file_name.dat
To restore a site from a backup file on a server share, and to overwrite any existing site at the new location, use the following syntax:
stsadm.exe -o restore -url http://server_name/site -filename \\share\folder\file_name.dat -overwrite
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.
Important
stsadm –o deletesites –deleteusers false