Maintenance Plan Problems

  • Hi all,

    I'm having a problem with a maintenance plan I created and wonder if anyone could help out.

    I have a program that automatically exports a backup of some configurations and outputs them in a xml file. I tried to setup a maintenance plan to automatically delete any xml files older than a certain age, but that didn't work. I then had the export output in the .bak format, but the maintenance plan still didn't work.

    I then created a database backup to the exact same directory and the maintenance plan removed the .bak files that SQL created, but not the ones I created.

    Can SQL only delete files that it created? If so, is there a way around this?

    Thanks for the help.

  • Yes - the utilities in SQL Server to remove backup files will only remove actual SQL Server created files. You could try setting up the job to remove text files (report files) and see if that works - but I don't think it will.

    Your best alternative is to move outside SQL Server and use a scripting language to delete the files. Powershell is real simple to use for this, as well as VBScript and other scripting languages.

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Jeffrey Williams-493691 (5/6/2010)


    Yes - the utilities in SQL Server to remove backup files will only remove actual SQL Server created files. You could try setting up the job to remove text files (report files) and see if that works - but I don't think it will.

    Your best alternative is to move outside SQL Server and use a scripting language to delete the files. Powershell is real simple to use for this, as well as VBScript and other scripting languages.

    Thanks for the info. I took your advice, kind of.

    I still wanted the logging from SQL and the ability to send an email if the cleanup job fails so I created a new job that runs a CMD line script and I have a maintenance plan that calls this job. So far it's working great!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply