Replacing Maintenance tasks now using SSMS 22 - what to do with File operations

  • Unfortunately I'm using SSMS 22.

    It didn't come with maintenance plans by default. I ran visual studio installer to install the extra components (SSIS, B1 and something else) so I could create tasks.

    I can now create tasks but cannot see the toolbox to add tasks e.g. backup task. So can only create an empty plan with in SSMS. Wish I knew this earlier wouldn't have bothered getting VS installer running.

    I read this is by design, maintenance tasks are being phased out.

    To replace these plans with Agent jobs.

    I can replace the backup/reindex tasks with TSQL scripts in SQL Agent jobs

    But how to handle file maintenance e.g.

    1. Delete old backup files
    2. Delete text files for jobs

    Should I use the undocumented SPs that maintenance plans use e.g.

    EXECUTE master.dbo.xp_create_subdir N'G:\SQL Backups\MaintTasks\myNewDataBase'

    EXECUTE master.dbo.xp_delete_file 0,N'G:\SQL Backups\MaintTasks',N'bak',N'2026-05-28T13:51:49',1

    or

    do add steps in powershell/cmdshell for file handling with its difficult error handling and reporting to SQLAgent.

    I'm tempted to use the undocumented SPs for reliability/ease.

    I want to avoid to have packages created in some flavour of Visual Studio or other environment for what are v.simple tasks.

     

     

     

     

    • This topic was modified 5 hours, 43 minutes ago by terry999.
  • https://ola.hallengren.com/sql-server-backup.html is a great, widely used solution, including cleanup of old files, driven by stored procedures that can be incorporated into jobs.

     

  • Thank you, I had seen these scripts mentioned elsewhere.

    I wanted to stay on maintenance plans because when away my IT colleague with few SQL skills has managed to fix/diagnose issues with the simple GUI of maintenance plans.

    Good to see these scripts use undocumented SPs, so if I use them and they change breaking jobs everyone using the Ola scripts will break too - solutions, well its MS so workarounds will be developed but much smarter people than me.

     

     

     

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

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