SQL Server Maintenance Plan: Cleanup Task

Hram Admin 0 Reputation points


Some time ago I noticed that my two maintenance plans were working incorrectly: the cleanup tasks that must have been deleting files older then 2 weeks had not been really deleting anything and my oldest files were ~29.02.2024. The reason was that I haven't check the "Include the first-level subfolders checkbox - right after checking it and re-runing the task the files older then two weeks have been deleted.

Nevertheless, now I started seeing the files older then two weeks once again:


The cleanup task that doesn't work is the final task of the MP:


If I create exactly the same task as the "single-tasked MP"Task2

...and execute it - all works perfect (today is 17.05.2024):

Why does the cleanup task work when the task is in the separate MP and does not work when it is one of 4 tasks in a MP ?

Thank you in advance,

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,100 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 42,561 Reputation points

    When do the cleanup task start?

    It takes the age for very serios, the file are age of 13 day and 23:39 hour old, the files won't be deleted; of course.

    1 person found this answer helpful.

  2. ZoeHui-MSFT 34,581 Reputation points

    Hi @Hram Admin,

    Please have a check if the files will be cleaned on 05/18?

    Like Olaf said, it may need to follow Strict 24-hour.Regards,

    Zoe Hui

    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments