This project is read-only.

Compact command doesn't work in sheduler On Windows Server 2008.

Jun 16, 2009 at 9:28 AM


I'm using bat file to daily backup my database:

D:\WA-PRO\expressmaint -S SERVER2008\SQLServer -U sa -P XXXX -D WAPRO -T DB -B E:\Backup\WAPRO -R E:\Backup\WAPRO\WAPRO -BU WEEKS -BV 1 -RU WEEKS -RV 1 -TO 5
compact /C /S:E:\Backup\WAPRO\WAPRO *.bak

Backup is working but compact command doesn't. Any suggestions why?

Jun 18, 2009 at 8:06 PM

Does it work if you execute the compact cmd on its own from an Admin cmd prompt? What account does the scheduled task run under? I've just created the following batch file on Windows 7 and it works.

@echo off
expressmaint -s (local)\SQL2005 -T DB -D ALL_SYSTEM -B C:\Backups -BU DAYS -BV 1 -R C:\Reports -RU DAYS -RV 1
compact /C /S:C:\Backups /Q *.bak  >compress.txt



Jun 19, 2009 at 8:36 AM

Yes it works if i execute the compact cmd on its own from an admin command promt. In sheduler task in want run. I'm using AD admin account in task sheduler.

Jun 19, 2009 at 3:58 PM

You could try adding an output file to the compact command as in my example to see if it logs any errors in that but other than permissions (which doesn't seem likely) I don't know why it wouldn't work, you've proved the syntax is valid.

Sep 21, 2009 at 10:00 AM

Sorry for so long time I haven't reply. I have checked "Run with highest priviliges" on on main tab of the properties window of the backup task box and now compact compresses backup files. :)