There are various third party SharePoint Product available in the market to do detailed backup of SharePoint site. But not all the project/Organisation can afford a third party product.
There are two kinds of OOB Backup Strategies in Office SharePoint Server 2007:
1. Using Central Administration –> Operations –> Backup and Restore
2. Using STSADM –> – o backup –url [site path] –filename [where to save the file]
STSADM command line option is more reliable compare to SharePoint CA backup.
I have created this script creates which takes daily backup of a site collection. I have found few more script online and many of them didn’t work for me. The script does the following
- Determine the lock status – (This is for sites which is large in size If any changes made to the site collection during the backup process, the backup can become corrupted. The preferred approach would be locking the site collection using the
STSADMtill the backup process is complete. Once the backup process completes, reset the site collection to its default state)
- Locks the site collection
- Creates a file name using current date
- Creates backup
- Unlock the site collection
@echo This script will backup your site: [Site Name]
cd c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo locking site collection before the backup process starts
stsadm -o getsitelock -url http://<Your Site Collection>
stsadm -o setsitelock -url http://<Your Site Collection> -lock readonly
@echo site collection is now locked
stsadm -o backup -url http://<Your Site Collection> -filename C:\Back\Backup_%date:~-4,4%%date:~-7,2%%date:~4,2%.bak -overwrite
@echo backup completed
stsadm -o setsitelock -url http://<Your Site Collection> -lock none
@echo Site lock removed
Copy the above code and do the necessary changes and Save it as a .bat file in a preferred location.
Automate your Backup
Create a new Windows Scheduled Task by going to Start–> Control Panel –> Scheduled Tasks –> Add Scheduled Task
Follow the wizard and schedule the .bat file created above to run at a frequency of your own choosing.