There are many ways to automatically backup MS SQL Server databases even if you use an Express version and do not have SQL Agent installed.
I sketched one possible solution some time ago, calling T-SQL commands from a batch file which is executed as a Scheduled Task.
If you are running MySQL databases under Linux, you may be aware of a tool called automysqlbackup, which runs as a cron job, creates dumps of MySQL databases and rotates daily and weekly backups.
During the last couple of days I translated this script into PowerShell to backup MS SQL Server databases in a similar way.
automssqlbackup provides the following functionality:
- Local or Remote backup
- Rotation of daily and weekly backups
- Optionally zipping backups
- Logging
- Notifications by e-mail
The first release of automssqlbackup is version 0.25 to reflect the current version 2.5 of automysqlbackup, which it is based on.
automssqlbackup is available for download here.
Pingback: Zipping Files with PowerShell « devioblog
Pingback: Updating automssqlbackup « devioblog
Pingback: ‘Backup failed for Server’ raised in SMO Backup « devioblog
How does this script pick which ones to archive. Out of 20 DB’s that it backed up, it only archived 2 of them. Thanks.
Generally, *every* .bak should be zipped. Although I occasionally notice that a .bak is not deleted, but this happens quite rarely.
Make sure you use the latest version which zips using SharpZipLib rather than Explorer’s zipped “folders”.