Here's an extract from a backup guide I wrote for a customer a while back, it's designed to complement a full SQL backup plan but allows you to restore single sites or site collections so that you don't have to roll back the whole environment for the sake of one site / docuement.
The script is taken from MSFT best practice.
In order to perform a backup at site level, firstly a batch file must be created with the following content:
cscript c:\backup\scripts\stsadm_backup.vbs
the contents of the stsadm_backup.vbs file should be similar to:
Option ExplicitConst STSADM_PATH = "C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\stsadm" Dim objFso, objFolder, objFiles, objFile, objShell, objExec, strResult, objXml, objSc, objUrl, strUrl, strFileName, strCmdSet objFso = CreateObject("Scripting.FileSystemObject")Set objFolder = objFso.GetFolder("C:\backup\")Set objFiles = objFolder.FilesWScript.Echo "Begin backup" ' Delete all backup files currently present in the backup folder. For Each objFile in objFiles objFile.Delete(True)Next ' Retrieves all site collections in XML format.Set objShell = CreateObject("WScript.Shell")Set objExec = objShell.Exec(STSADM_PATH & " -o enumsites -url http://[server]/")strResult = objExec.StdOut.ReadAllWScript.Echo strResult ' Load XML in DOM document so it can be processed.Set objXml = CreateObject("MSXML2.DOMDocument")objXml.LoadXML(strResult) ' Loop through each site collection and call stsadm.exe to make a backup.For Each objSc in objXml.DocumentElement.ChildNodes strUrl = objSc.Attributes.GetNamedItem("Url").Text strFileName = "C:\backup\" & Replace(Replace(strUrl, "http://", ""), "/", "_") & ".bak" strCmd = STSADM_PATH & " -o backup -url """ + strUrl + """ -filename """ + strFileName + """" WScript.Echo "Backing up site collection " & strUrl & " to file " & strFileName & " using the following command " & strCmd objShell.Exec(strCmd)Next WScript.Echo "Backup of portal site collections successful"
The resulting files can then be backed up to the relevant media and means that if a single site or site structure becomes damaged they can then be restored without affecting the ancillary sites on the server farm.