Monday, September 24, 2007

Windows SharePoint Services allows you to back up and restore individual Sharepoint sites hosted on the server (or server farm). STSAdm.exe allows you to backup and restore a Sharepoint site. STSAdmn.exe allows you to back up and/or restore a specific Sharepoint site using MSDE, in fact STSAdm.exe is your only backup and restore option for the free version which uses MSDE. When you create a back up of a Sharepoint site, you are backing up the content database for the site, including all the sites pages, document libraries and lists. It also backs up the security and features settings. STSAdm.exe will create a single file with all of the data. You can also use STSAdm.exe to restore your Sharepoint site to the same location or to a different location.
Note: If you wish to move a Sharepoint site to a new server, you must use the Sharepoint Migration Tool.
In order to perform a backup or restore with STSAdm.exe you must be a member of the server's Administrators group or the SharePoint Administrators group. Before we begin there are a few things you need to be aware of. - You should not use STSAdm.exe if you are using SQL Server 2000 or SQL Server 2005 as your database, instead use the backup tools in SQL - Access issues can occur when backing up or restoring a Sharepoint site. You can script STSAdm.exe with a batch file to run during your scheduled maintanance window. - Backups and restores should not be performed when the server is under active load. Again you can script STSAdm.exe with a batch file to run during your scheduled maintanance window. - Ensure that there are no duplicate names when restoring a Sharepoint site. Finally, before you begin you should list the Sharepoint sites so that you can choose which sites you wish to backup. To enumerate the sites run the following command.
STSAdm.exe -o enumsites -url [URL]

To perform a backup of a site, you can use the following command: STSAdm.exe -o backup -url http://server/site -filename C:\backups\backup.dat

If you are scripting this and wish to overwrite any existing backups with the same name you can add the -overwrite switch. STSAdm.exe -o backup -url http://server/site -filename c:\backups\backup.dat -overwrite As I previously mentioned you can use STSAdm.exe to restore a Sharepoint site as well. To restore a site from a backup file to a new site use the following command.
stsadm.exe -o restore -url http://server/site -filename backup.dat
To restore a site from a backup file and overwrite the existing site use the following command.
stsadm.exe -o restore -url http://server/site -filename \\share\folder\backup.dat -overwrite

Notice I specified a share on a network? You can backup and restore from a network share by specifying a UNC path!

No comments: