Backup and Restore in SharePoint is possible through the following tools.
Stsadm.exe
Smigrate.exe
Backup using stsadm.exe
Use the Stsadm.exe command-line tool to backup or restore a site. The Stsadm.exe tool takes the following parameters.
Parameter 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:
- Filename, such as backup.dat
- Path on the local hard drive, such as local_drive:\path_name\file_name.dat
- Path on a network share
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
Restore Using stsadm.exe
To restore a site, you use the restore operation with the Stsadm.exe command-line tool. The restore operation takes the following parameters:
| Parameter | | 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.
- You can restore a site to an existing site.
- You can restore a site to a new site on the same server.
- You can restore a site to a separate server, with a separate installation of Windows SharePoint Services that uses a copy of the configuration database from the original server.
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
Backup Using Smigrate.exe
smigrate.exe -w <Web site URL> -f <backup filename> [-e -y -u <username> -pw <password>]
For example,
To create a backup of http://mysps/samplesite1 to a file called backup.fwp at the root of the c:\ drive, without including any subwebs of the Web site, you would type the following:
smigrate.exe -w http://mysps/samplesite1 -f c:\backup.fwp -e
Restore Using Smigrate.exe
To restore a site, you use Smigrate.exe with the following parameters:
Syntax
smigrate.exe -r -w <Web site URL> -f <backup filename> -u <username> -pw <password>]
Example, to restore the above site to http://newserver/samplesite2, you would use type the following:
smigrate.exe -r -w http://newserver/samplesite2 -f c:\backup.fwp