Fill in your server details and get four ready-to-use files: the T-SQL backup script, a batch file that runs it with logging, a cleanup script for old backups, and the Task Scheduler command. Everything is generated in your browser.
How to use the files
- Create the folders
scriptsandlogsinside your backup folder, and give the SQL Server service account write access to the backup folder. See error 3201 if you are unsure which account that is. - Save each tab's content with the file name shown above it.
- Run
run_backup.batonce by hand. Check the log and the backup folder. - Run the Task Scheduler command in an administrator command prompt, then right-click the new task and choose Run to test it under the scheduled account.
What the script does
It loops over the selected databases and writes one time-stamped file per database, so backups never overwrite each other. Log backups skip databases in SIMPLE recovery, which cannot have log backups. The batch file records success or failure in a log, and deletes old backups only after a successful run, so a string of failures never removes your last good copy.
What it does not do
- Copy backups off the server. Add an off-site step with Google Drive or FTP/FTPS.
- Alert anyone on failure. Someone has to read the log, or you add email.
- Retry. A temporary failure means no backup until the next run.
The full walk-through is in how to schedule SQL Server Express backups.
Rather not maintain scripts?
Velocity runs scheduled SQL Server and folder backups through a Windows service, sends them to a local folder, FTP/FTPS or Google Drive, retries failures automatically and can email you after each run.