views:

1017

answers:

3

I have a SQL 2005 Maintenance plan that runs a backup to create a .bak file, and, on successful completion is supposed to run a Maintenance Clean Up task to delete any .bak files in the folder the back up task saves to that are older than 5 days.

My backups are being created, but my old files aren't being deleted. I don't see any errors in the log. I think that perhaps I have a permissions issue -- that the account the job is run under needs access to the folder the .bak files are to be deleted from. Does this seem like a likely cause of .bak files not being deleted?

How do I find out what account the job is run under? I'm guessing it would be the SQL Agent account. I thought that would be the account named 'SQLServer2005AgentUser' so I tried giving that account full control, but my .bak files are still not being deleted.

Should I take a different approach to cleaning up the old files? Or is there something else I'm doing wrong or not understanding?

A: 

I had this exact same problem. As I recall, the problem was with how I specified the file extension on the clean up task settings.

On the Maintenance Cleanup Task, check your setting for 'File extension'. If it's set to ".bak", change it to "bak" (no quotes obviously, and no dot).

This fixed the problem for me. This drove me crazy!

Jay Riggs
Thank you so much. I had a '.' in there. Took it out, and all works as anticipated. You made my day!
hilary
Glad it helped! Most of the time when I'm troubleshooting a problem I end up learning something worthwhile along the way. I didn't have that experience when I was dealing with this issue -- probably why I found it so frustrating.
Jay Riggs
A: 

Even putting just "bak" also I am getting problem

A: 

In the path to the location of the Backup Files, make sure you have a backslash after the last folder in the path eg.

E:\MSSQL\Backups\

Worked for us after driving us nuts for ages...

Benj