Friday, June 01, 2007

Backup of SharePoint

Backing up SharePoint is not just backing up the databases and hoping for the best. Best Practice is actually using the tool stsadm and create backupfiles that can be then be backed up to tape (or similar). So, how to create a script that takes backup?

Example of script for catastrophic backup:
@echo offecho start Catastrophic backup >> backup.log
date /t >> backup.log
time /t >> backup.log
"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm" -o backup -directory \\srv01\Backup\CatastrophicBackup -backupmethod full >> backup.log
date /t >> backup.log
time /t >> backup.log
echo end Catastropic backup >> backup.log

This will create a new folder in the directory \\srv01\Backup\CatastrophicBackup where backup of all databases will be done.

However, the problem with this is that you can't restore just one file... so what to do?
Two alternatives:
1. Just export all site data to file using "stsadm -o export", and when needed, restore to secondary sharepoint (not public) and retrieve file.
2. Use 3:rd party backup solution like DocAve 4.1 by AvePoint that has single-item-restore.

An example of how to uses stsadm for creating a normal export is:

stsadm -o export -url http://portal -filename "\\srv1\Backup\portal.bak" -version 4

This will export everything from http://portal to \\srv1\backup\portal.bak including all versions of all files. Please note that if you have lots of data, it might take som time to do this.

Note that there is also a version of "stsadm -o backup" that backs up entire sitecollections but for "simpler" backup set ups I don't find that necessary.

Also note that this is how you handle backup for smaller installations where you can acctually run an export of all data each night. For larger installations, more complex backup methods based on incremental backup or snapshotting can be used.

Since we're using sharepoint for backing up, we don't really have any need for maintaining transactionlogs in SQL server som make sure you have selected "Simple Recovery Model" for each SharePoint database.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

No comments:

Post a Comment