Same old problem keeps repeating at every client place! The customized backup jobs sometimes fail to clean up the files older than 2 days (or whatever the threshold is) and the backup jobs fail eventually when the drive gets full, One smart and quick solution for this is to use the 'forfiles' utility and schedule it as a task in windows or use xp_cmdshell to schedule the same as a SQL server agent job. The command looks something like the below:
forfiles /p D:\backup\ /s /m *.trn /d -2 /c "cmd /c del @file"
Change the extension from .trn to .bak if you are trying to cleanup full backup files instead of transaction log files.
forfiles /p D:\backup\ /s /m *.trn /d -2 /c "cmd /c del @file"
Change the extension from .trn to .bak if you are trying to cleanup full backup files instead of transaction log files.
No comments:
Post a Comment