matt40k Posted November 16, 2009 Author Posted November 16, 2009 Indeed, you can create a schedule task, either the .exe with args or the batch file (or vbscript). Interesting thing, Autumn removes compression, both for the SQL 2005 and SQL 2008.
Grommit Posted November 17, 2009 Posted November 17, 2009 One is the source, the other is the program? I do not undersstand... must both be installed or something like that as most installations come in a single zip
matt40k Posted November 17, 2009 Author Posted November 17, 2009 I do not undersstand... must both be installed or something like that as most installations come in a single zip There is two zip\7zip. One is the actual program, this has one .exe file, pretty much ready to go. The other is the source code, so if you have C# guru you can have a play and make your own version. Basically 99.9% of people won't ever need this. 1
Grommit Posted November 18, 2009 Posted November 18, 2009 There is two zip\7zip. One is the actual program, this has one .exe file, pretty much ready to go. The other is the source code, so if you have C# guru you can have a play and make your own version. Basically 99.9% of people won't ever need this. tHANKS
matt40k Posted January 15, 2010 Author Posted January 15, 2010 And for those who don't want to register on EduGeek (you fool!!) http://matt40k.xen.prgmr.com/tidybackups/tidybackups.exe
Rawns Posted January 28, 2011 Posted January 28, 2011 (edited) I've downloaded your latest Tidybackups.exe from Sourceforge and I'm testing it out on a test enviroment on which I've set up a batch file to backup SIMS and FMS with dbAttach.exe in the usual manner and then run the following command at the end: "tidybackups.exe" /PATH:"C:\Backup" /DAYS:5 /ZIP I had a couple of BAK's and ZIP files and it seems to have deleted every previous backup apart from one sims and fms backup, and the new BAK files get deleted before they even get compressed! Ideas? The full script just in case: @ECHO off PushD %~dp0 SET SIMSDrive=C: SET SQL=\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL ECHO SIMSDrive=%SIMSDrive% ECHO Backing up SIMS "%SIMSDrive%\%SQL%\Binn\dbattach.exe" /BACKUP /AUTO /SERVER=%COMPUTERNAME%\SIMS2008 /DATABASE=SIMS /USER=sa /PASSWORD=****** ECHO Backing up FMS "%SIMSDrive%\%SQL%\Binn\FMSSQL\dbattach.exe" /BACKUP /AUTO /SERVER=%COMPUTERNAME%\SIMS2008 /DATABASE=ccsfms /USER=sa /PASSWORD=****** ECHO Tidying "tidybackups.exe" /PATH:"%SIMSDrive%\%SQL%\Backup" /DAYS:5 /ZIP ECHO Done Edited January 28, 2011 by Rawns
vikpaw Posted January 28, 2011 Posted January 28, 2011 @rawns @matt40k - are you getting that de-ja-vu feeling, again?! I know i am. Are you sure you're not running the old version, that did this to you last time?
Cools Posted January 29, 2011 Posted January 29, 2011 (edited) i use forfiles forfiles -p "C:\what\ever" -s -m *.* -d - -c "cmd /c del @path" See forfiles /? for details If you don't have forfiles installed by default on your machine, get it from Microsoft FTP server. Place it to C:\WINDOWS\system32\forfiles.exe Edited January 29, 2011 by Cools
Rawns Posted January 31, 2011 Posted January 31, 2011 (edited) @rawns @matt40k - are you getting that de-ja-vu feeling, again?! I know i am. Are you sure you're not running the old version, that did this to you last time? I'm sure! I double checked before posting! I'm trailing the latest version downloaded from SourceForge dated 22-10-2010 (Version 1.4.12.38). Edited January 31, 2011 by Rawns
vikpaw Posted January 31, 2011 Posted January 31, 2011 I'm sure! I double checked before posting! I'm trailing the latest version downloaded from SourceForge dated 22-10-2010 (Version 1.4.12.38). Maybe the version control got borked! I just found myself taken off the staff emergency phone list because somebody updated a 4 year old file! That's probably why i was working all weekend, while everyone else ended up at the beach
matt40k Posted February 1, 2011 Author Posted February 1, 2011 What's the creation date on the zips? You also might want to look at the preserve option. 1
Rawns Posted February 10, 2011 Posted February 10, 2011 What's the creation date on the zips? You also might want to look at the preserve option. Thanks Matt. Added a preserver tag and it is compressing, then deleting. I think I may not fully understand what preserve does though. My command is this: "tidybackups.exe" /PATH:"C:\%SQL_DIR%\Backup" /DAYS:5 /ZIP /LOG /PRESERVE:5 I assume that this should keep only the 5 latest compressed backup files and delete any older? I've been running it as a scheduled task daily on my test environment and I have 10 backups for both SIMS and FMS?
matt40k Posted February 10, 2011 Author Posted February 10, 2011 Hang on, was about to say add /debug, but just noticed I haven't add the timestamp to the output (doh!!)
matt40k Posted February 10, 2011 Author Posted February 10, 2011 @Rawns Can you download: Download tidybackups from SourceForge.net, then add /debug to command and upload the log. 1
Rawns Posted February 10, 2011 Posted February 10, 2011 The log lies. It says the 2 new backups have been compressed but they have not been... 10/02/2011 10:20:32 - Tidy Backups Utility - 1.4.13.39 10/02/2011 10:20:32 - Admin: True 10/02/2011 10:20:32 - OS Version: Microsoft Windows NT 5.1.2600 Service Pack 3 10/02/2011 10:20:32 - Disc letter: C: 10/02/2011 10:20:32 - Disc label: Local Disk 10/02/2011 10:20:32 - Disc format: NTFS 10/02/2011 10:20:32 - Local disc: True 10/02/2011 10:20:32 - Disc type: Fixed 10/02/2011 10:20:32 - Disc ready: True 10/02/2011 10:20:32 - Disc size: 149934 MB 10/02/2011 10:20:32 - Free space: 79259 MB 10/02/2011 10:20:32 - Username: prawnsley 10/02/2011 10:20:32 - Domain: SOMERSET 10/02/2011 10:20:32 - Arguments: /PATH:C:\\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL10.SIMS2008\MSSQL\BACKUP /DAYS:5 /ZIP /PRESERVE:5 /LOG /DEBUG 10/02/2011 10:20:32 - Days: 5 10/02/2011 10:20:32 - Path: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110201_093800.zip - 01/02/2011 09:37:32 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110201_180300.zip - 01/02/2011 18:02:49 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110202_180300.zip - 02/02/2011 18:02:43 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110203_180300.zip - 03/02/2011 18:02:50 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110207_180400.zip - 07/02/2011 18:04:10 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110208_180300.zip - 08/02/2011 18:02:41 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110209_180300.zip - 09/02/2011 18:03:17 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110210_090700.zip - 10/02/2011 09:07:28 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110210_102000.bak - 10/02/2011 10:20:15 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110201_093500.zip - 01/02/2011 09:34:38 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110201_180000.zip - 01/02/2011 18:00:03 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110202_180000.zip - 02/02/2011 18:00:02 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110203_180000.zip - 03/02/2011 18:00:03 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110207_180000.zip - 07/02/2011 18:00:15 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110208_180000.zip - 08/02/2011 18:00:02 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110209_180000.zip - 09/02/2011 18:00:05 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110210_090500.zip - 10/02/2011 09:04:43 10/02/2011 10:20:32 - C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110210_101700.bak - 10/02/2011 10:17:04 10/02/2011 10:20:32 - Path permission: Full Control 10/02/2011 10:20:32 - Preserve: 5 10/02/2011 10:20:32 - Safe: False 10/02/2011 10:20:32 - Archive: True 10/02/2011 10:20:32 - Log: True 10/02/2011 10:20:32 - Log path: C:\Documents and Settings\prawnsley\Desktop\Test Backup\tidybackups_log.txt 10/02/2011 10:20:32 - Log permission: Full Control 10/02/2011 10:20:32 - Beginning 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110210_101700.bak 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110210_090500.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110209_180000.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110208_180000.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110207_180000.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110210_102000.bak 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110210_090700.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110209_180300.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110208_180300.zip 10/02/2011 10:20:32 - PRESERVED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110207_180400.zip 10/02/2011 10:20:32 - COMPRESSED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110210_102000.bak 10/02/2011 10:20:32 - DELETED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\ccsfms_cp693_mnw_20110210_102000.bak 10/02/2011 10:20:32 - COMPRESSED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110210_101700.bak 10/02/2011 10:20:32 - DELETED: C:\\Program Files\Microsoft SQL Server\MSSQL10.SIMS2008\MSSQL\Backup\sims_cp361_mnw_20110210_101700.bak 10/02/2011 10:20:32 - Finishing tidybackups_log.txt
matt40k Posted February 10, 2011 Author Posted February 10, 2011 If you use the /debug, it'll just output what it SHOULD do. If you run it again it, but without the debug, it should now compress\delete them.
Rawns Posted February 10, 2011 Posted February 10, 2011 Ahh, I see. From the preserve, I can see it's keeping the latest 5 SIMS and FMS backups, but still don't understand why it's not deleting the older backups.
vikpaw Posted February 10, 2011 Posted February 10, 2011 Is it keeping 5 days and preserving 5 beyond that?? So you get 10. Not sure i see how it works. Is it working on the date + time, so if you took an interim backup mid day, where would that figure in the safelist? I noticed some of Rawns backups are from the same day.
Rawns Posted February 10, 2011 Posted February 10, 2011 (edited) Just tested with a DAYS:4 and PRESERVE:1 command. It's has now deleted a number of backups and I now have 5 backups of SIMS and 5 backups of FMS data - BUT its deleted the newest backups and kept the five oldest ones! Edited February 10, 2011 by Rawns
vikpaw Posted February 10, 2011 Posted February 10, 2011 I hope you made a backup! Maybe you needed DAYS:1 and Preserve:4, or perhaps, not DAYS at all just preserve... Could do with some "/?" docs i guess.
Rawns Posted February 10, 2011 Posted February 10, 2011 Hahah! It's test data on my system so its no big deal that it's been deleted. I did try DAYS:1 and PRESERVER:4 after and it still keeps all the old backups. I'll try just Preserve...
matt40k Posted February 10, 2011 Author Posted February 10, 2011 preserve should be the min number of backups (of each database) that it keeps. I'm going to replace it with /min i think in the next release. So for example, you backup everyday, you have it set to delete backups over 5 days, but for some reason it stops, 2 weeks later, you have no backups, unless the preserve option has been set in which case, you have at least that number of backups you've defined. 1
Rawns Posted February 11, 2011 Posted February 11, 2011 I see, so you can actually run the script with just the /DAYS:x and /ZIP command without preserve? The only issue is that without adding the /PRESERVER parameter, the BAK file gets deleted before it's compressed.
matt40k Posted February 11, 2011 Author Posted February 11, 2011 That's because it's older then the days set. Pointless compressing it then deleting it.
Rawns Posted February 11, 2011 Posted February 11, 2011 How can it be older then 5 days if it's only been created?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now