This script was created to perform a backup on MS SQL 2005 Express. The lite version of MS SQL does not have built in maintenance tasks. Then robocopy moves the files from the box to a CIFS share. Then a forfiles line is used to delete old copies of the backups.
sqlcmd -S servername\SQLinstanceName -E -Q "EXEC sp_BackupDatabases @backupLocation='d:\backups\', @backupType='F'"
robocopy.exe d:\backups \\nas\backups\servername /mir
Forfiles -p d:\backups -s -m *.* -d -2 -c "Cmd /C del @FILE"
http://support.microsoft.com/kb/2019698
ReplyDelete