I have a maintenance plan setup for all my user databases on a particular server, which does all the usually things at various intervals.

The 7th and final subplan is a two stage cleanup plan; firstly old full backups are deleted, then old transaction log backups are deleted. These tasks appear to run successfully - the subplan's job history reports that the plan was run on time, and runs xp_delete_file twice - but clearly files are not deleted.

The task settings are:

  • Backup Files
  • Search folder and delete based on extension - .bak
  • Include subfolders
  • Delete files older than 2 weeks

and

  • Backup Files
  • Search folder and delete based on extension - .trn
  • Include subfolders
  • Delete files older than 5 days

Any ideas?

link|improve this question

60% accept rate
pls mark yourself as having the correct answer! – Nick Kavadias Dec 18 '09 at 3:24
feedback

2 Answers

up vote 2 down vote accepted

And of course, as soon as I post I figure out the answer...

There a number of people suffering similar problems (2005 as well) and solutions range from scripts to SPs and to hotfixes.

Mine was much simpler - I'd specified '.BAK' as the extension, rather than 'BAK'!

It's a bit of a 'Doh!' moments, but nevertheless, I'd have hoped that the GUI would have either handled the situation or at least complained to me about the problem.

Anyway, problem solved...

link|improve this answer
Glad you got it figured out, but how and why would the GUI know what you intended when you mistyped the file extension? Should the OS\Software configure things the way it sees fit based on what it thinks you intended or should it configure things based on what you type\set? – joeqwerty Dec 14 '09 at 13:20
I didn't mistype anything - I merely added something extra that isn't required (the '.' divider). If the extension entered starts with a leading period, it can only be extraneous and either a) could be removed or b) a warning given - under Windows, you cannot have an extension that begins with '.'. It's just basic validation. – CJM Dec 14 '09 at 16:03
The issue these days is the file..bak is a valid filename in windows... but in this case I'd agree that the GUI could warn you to make sure that's what you meant to do - I was caught with this myself a few months back and it drove me nuts until I figured it out! – Chris W Dec 18 '09 at 9:43
@Chris W. MyFile..bak is a valid filename - 'MyFile.' is the name, the last'.' is always the separator, and the 'bak' is the extension. So there is no way that my '.bak' extension could be valid, and so there should have been a validation error. But it's a moot point; having done this a trillion times before, I shouldn't have made such a silly error. – CJM Dec 20 '09 at 21:43
feedback

I agree that the whole cleanup issue is not 100% clear and intuitive. Some forums say use *.* for the file extension, which I have found works if other issues are correct too, but you also should make sure that the path has a \. Also check that verify is ticked when you create the back up in the first place. If the path needs a backslash and yet doesn't have one then its not difficult programming to post a warning. Same with the dot. For a program that is in such wide use, these are simple error checks that are not included by Microsoft. But hey, that's why people like us have a job!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.