I recently backed up our WSS 3.0 site using the STSADM command line tool and after it was finished every WSS site collection was marked read-only and none of our users could edit the sites. I knew the backup using the stsadm tool put the site in read-only mode during backups but was mystified why it kept it that way when the backup was completed. It seems the force and nositelock parameters were first introduced in Windows SharePoint Services 3.0 with Service Pack 2 (SP2).
If changes are made to the site collection during the backup process, the backup can become corrupted. Backing up large site collections can take a long time. To reduce the chance that user activity will interfere with a site collection backup, or that the time that is required to back up large site collections will exceed the available maintenance window, follow these recommendations:
■ Do not use the Stsadm backup operation for site collections larger than 15 gigabytes (GB). For larger site collections, see the recommendations in Back up and restore site collections by using built-in tools (Windows SharePoint Services 3.0).
■ For the duration of the backup, set the site collection URL to read-only by using the Setsitelock: Stsadm operation (Windows SharePoint Services). This lets users view content on the site, but prevents activities such as adding or changing content that interfere with the backup process. When the backup is complete, return the access setting of the site collection URL to its default state.
In Service Pack 2 for SharePoint Products and Technologies, site collections are automatically locked as read-only before a backup process occurs. Therefore, there is no need to use the Setsitelock: Stsadm operation (Windows SharePoint Services) operation. If you do not want site collections to be locked as read-only, you must specify the nositelock parameter that is available in Windows SharePoint Services 3.0 with Service Pack 2 (SP2).
Setsitelock: Stsadm operation (Windows SharePoint Services)
To determine the lock status of the site, you can use the following getsitelock syntax
C:\>stsadm -o getsitelock -url http://tclconnect
Once the lock status of the site collection is determined, you can use the noaccess parameter of the setsitelock operation to lock out all users to the site:
stsadm -o setsitelock -url http://server_name -lock noaccess
You can use the Backup operation to create a backup of the site collection:
stsadm -o backup -url http://server_name -filename "filename.bak" -overwrite
After the site has been backed up, you can use the none parameter of the setsitelock operation to remove all locks to the site:
stsadm -o setsitelock -url http://server_name -lock none
Here’s a copy of the bat file that gets run to back up our WSS site using Windows Scheduler
@echo off
echo ====================================================
echo Backup Script For Office SharePoint Server 2007
echo ====================================================
cd c:\program files\common files\microsoft shared\web server extensions\12\bin
@echo off
stsadm -o Backup -nositelock -url http://tclconnect -filename d:\sharepointbackups\backup.bak -backupmethod full -overwrite