Request for Backup Script | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Request for Backup Script

After a recent close shave involving a misbehaving backup tape drive, I now want to keep a backlog of historic backups on disk for extra security.<br /><br />Currently my backups are working nicely, the sql server writes to a file on network drive, which is then swept up by the backup device. The file is overwritten each night.<br /><br />Looking for a script which will allow me to timestamp the backup, and clean up backups older than a set period. Similar to what a maintenance plan does… except without using a maintenance plan <img src=’/community/emoticons/emotion-5.gif’ alt=’;-)’ /><br /><br />I could code this myself but Id rather use a premade tested script as I dont have much time to be debugging a custom script from scratch.<br /><br />Any recommendations ?<br /><br />Thanks<br /><br />Chappy
You don’t want to use xp_sqlmaint with parameters as opposed to a plan? I use this for the handiness of the automated retention/deletion of old files. you must have a reason not to, i guess, maybe it doesn’t work with unc drives. Tom Pullen
DBA, Oxfam GB
Try this script (and others on the blog):
Thomas, I originally tried this method, using both a drive letter and UNC path. The problem being is that althopugh the backups worked ok, the deletion of the older files simply did not occur. The result being that the network storage started filling up, luckily I noticed it before it resulted in a failed backup Argyle, thanks this looks useful Cheers guys