SQL Maintenance Cleanup Task 'Success' But not deleting files

15,641

Check the file to see if it is a valid backup file. If the file is corrupt or in some other way damaged the process to remove the file won't do anything. You can check it by doing:

RESTORE HEADERONLY FROM DISK='d:\Path\To\Your\File.bak'
Share:
15,641

Related videos on Youtube

Seph
Author by

Seph

Updated on September 17, 2022

Comments

  • Seph
    Seph over 1 year

    I have a maintenance plan setup for a databases on a server. As part of the backup is a Maintenance Cleanup Task.

    SQL Version 2008

    The task that 'succeeds' is setup as:

    Delete backup files
    Correct folder (same address as the backup task)
    File extension: bak (NOT .bak)
    Delete files older than: 20 Hour(s)
    

    I have other similar cleanup tasks that occur in the same maintenance plan which work fine. This plan has worked fine in the past, I just noticed that last night it reported 'success' and the rest of the plan continued, however the file from 2 days ago still remains.

    I have checked similar questions such as this question, and this is not the case as my maintenance task worked fine two days ago and for the past several weeks:

  • Seph
    Seph about 13 years
    Thanks, this seems to have been the issue, the backup part of the plan was not ensuring the backups were valid.