July 23, 2013 at 12:03 pm
Hi ,
I had scheduled backups in Express edition 2008 using cmd and taskmanager. But I wantedto have an automated process to delete the .bak files rather doing manually. Please suggest me some steps or procedure.
July 23, 2013 at 12:05 pm
July 23, 2013 at 12:15 pm
I did but failed on it... Can you please clarify me on what steps to be involved...
July 23, 2013 at 12:18 pm
xp_delete_file is an undocumented extended procedure. Google it for parameters and usage.
Please fully understand the risk involved when using undocumented procedures before implementing them in any environment.
July 23, 2013 at 12:28 pm
Check for something like this. If you have problems, it might be a permissions problem.
EXEC xp_cmdshell 'DEL "C:\My\Full\Path.bak" /Q';
GO
I wouldn't advice to use undocumented procedures on a production environment, but it's up to you.
July 23, 2013 at 1:00 pm
Hi,
I found the below link which describes useful undocumented stored procedures. Does it mean to be good to use
EXECUTE xp_delete_file 0|1, 'file_name'
July 23, 2013 at 4:18 pm
stillconfused (7/23/2013)
Hi,I found the below link which describes useful undocumented stored procedures. Does it mean to be good to use
EXECUTE xp_delete_file 0|1, 'file_name'
Which link?
As I said, there are some risks involved in using undocumented stored procedures. These procedures might be helpful but might be removed or changed without prior advice. Is up to you.
July 23, 2013 at 4:45 pm
Worth checking this link - contains a part about file cleanup;
http://ola.hallengren.com/sql-server-backup.html
Cheers
Vultar
July 24, 2013 at 5:39 am
Another option if you don't want to mess around with undocumented SQL commands, would be to look into using the DOS command FORFILES. At my previous job, I had batch files (same as your cmd) that would fire a backup using SQLCMD, then clean up old BAKs and TRNs with FORFILES.
Jason
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply