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!

wss

Start -> All Programs -> Control Panel -> System
On the Advanced tab, click the Environment Variables button.
Select the variable Path and click the Edit button.
Add the following to the end of the Variable value field (don't forget the semicolon... the Path environment variable is a semicolon delimited string of directories):;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
OK out of all the dialogs.
Next time your system restarts, you'll be able to type STSADM.EXE at a command prompt from any directory on your system.
How to Backup Windows SharePoint Services
Backing up SharePoint Services isn’t as easy as making a copy of a file on the file system – but it’s not as difficult as trying to backup many of the organization’s legacy systems. The key to backing up SharePoint is to control what you’re backing up based on what information is changing. Backing up SharePoint can be as simple as usingthe STSADM tool, or depending upon your needs perhaps it’s the SMIGRATE tool. In either case you need to understand what precisely you want to backup and how you may want to do your restore.

Backup Options
There are essentially four ways to backup SharePoint Services: STSADM, SMIGRATE, SQL Database, and 3rd Party tools. We’ll examine each on the merits of strengths and weaknesses before reviewing the kinds of restores that most organizations face.
STSADM
The STSADM tool, which is a part of Windows SharePoint Services, is a Swiss army knife which his used to add web parts, change properties, and a variety of other actions including performing a backup of a site and all of it’s sub-sites. The STSADM tool is designed to backup one site with complete fidelity – that is, back up absolutely everything about a site. It does this task quite well. However, there are a few challenges.

First, most organizations find that they will be confronted with the need to do single-file level restores of files stored in SharePoint. This is because users will invariably accidentally delete a file that they didn’t intend to. As a result a file or a small group of files will need to be restored back to SharePoint. This is where STSADM’s story is less than stellar. In order to restore a single file a sequence of steps must be followed.

The first step in restoring a single file is to create a new virtual web server has to be created and extended for SharePoint Services. Then the STSADM tool is used to restore the existing site backup. From there the files are copied from the new instance of SharePoint services and finally put back in the site. Through this process the version history for the file is lost – unless each file is extracted and placed into services one at a time. This is in general a fairly onerous task to simple restore a single file.

Second, the actual date/time stamps of the versions and the person that checked them in will be lost. This can be an issue if version histories are a part of your information management audit trail.

Despite these two limitations for single-file restoration STSADM is the tool of choice for backing up SharePoint Services sites when it’s important that absolutely every aspect of the site is backed up and can be restored without question – it’s the gold standard for backing up Windows SharePoint Services.
SMIGRATE
SMIGRATE is another Windows SharePoint Services provided tool which can be used to backup a WSS site. However, it takes a radically different approach than STSADM. First, it doesn’t do a full fidelity backup – there are certain items which it doesn’t process. Neither permissions nor personalization is backed up in an SMIGRATE file. However, the fact that these are not backed up is countered by the simplicity which a single file can be restored.

The FWP file that the SMIGRATE tool creates is a renamed CAB file which contains a manifest.xml file and each of the individual files in the single site specified. This includes all of the pages which represent the site. So any file within the site, including the files that make up the site itself can be easily extracted and restored quickly.

The process for restoring a single file with SMIGRATE is as simple as opening the manifest.xml file, searching for the file to restore, extracting it, renaming it, and uploading it back to the portal. The time to restore is greatly reduced as is the complexity in completing the restoration.

One of the other differences between STSADM and SMIGRATE is that SMIGRATE only backs up one site at a time. It doesn’t backup sub-sites so it requires a potentially large number of individual backup commands to complete the backup of a large set of sites.

Despite the obvious limitations of not providing a complete backup, the SMIGRATE backup solution can be very valuable for organizations that need to be able to restore a single file with relative ease.
SQL Database Backup
Both of the two options above are new and unique to SharePoint. They are not the same tried, tested, and true solutions that administrators have been used to for a long time. For most organizations backing up SQL server databases is a core skill that has been developed over the last several years to the point of rote perfection. Backing up SQL server databases is supported by existing processes and techniques and because of that backing up the SQL server database directly is often a good strategy for an organization seeking to backup SharePoint services.

Most everything that SharePoint does is stored in the associated content database. Because of this most of the things that are necessary for reconstructing a site from a disaster will be found in the database. In fact a backup of the system plus a backup of the SQL server will restore the site. In most cases, however, it’s easier to use STSADM to make a baseline backup of the site and then use SQL server to restore from catastrophic events.

The challenge with SQL backups is essentially the same as STSADM. It’s an all or nothing proposition if you loose something in a site. The one further disadvantage SQL has over STSADM is that STSADM can backup sites individually. SQL backup must backup all sites at the same time.

When backing up SQL server databases for SharePoint there is no special care that needs to be taken, beyond getting an original backup of the system which includes the additional files necessary for a complete site