Maintenance Plan Cleanup Task Unable to remove Maintenance Plan text Reports

  • We create a maintenance plan to use the Maintenenace Cleanup Task to remove the text files created by the Maintenance Plan on the log directory drive:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG of our SQL Server. Options selected: delete files of the followingh type maintenance plan text reports, folder, include first level folder is checked and file extension txt for files older than a month. The job run successfully but the files are not removed. The SQL agent account is administrator on the server. We have logged into the server with the account and remove files manullay successfully.

    This is the message we got:

    "Message

    Executed as user: MIAMIDADE\SRVC_SQLSERVICE. Microsoft (R) SQL Server Execute Package Utility Version 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 6:38:08 PM Progress: 2008-05-07 18:38:09.53 Source: {DE2CD35B-0DE1-4A68-B49F-019AD5877647} Executing query "DECLARE @GUID UNIQUEIDENTIFIER EXECUTE msdb..sp".: 100% complete End Progress Progress: 2008-05-07 18:38:09.78 Source: Maintenance Cleanup Task Executing query "EXECUTE master.dbo.xp_delete_file 1,N'R:\Microsoft".: 100% complete End Progress DTExec: The package execution returned DTSER_SUCCESS (0). Started: 6:38:08 PM Finished: 6:38:10 PM Elapsed: 1.813 seconds. The package executed successfully. The step succeeded."

    Is this a bug? Does anyone has a solution to make this work? :hehe:

  • I thought the history cleanup task had to remove maintenance plan logs. Have you tried that task? I thought the maintenance task had limitations over which files it could remove.

    Is this SP2?

  • Yes is SP2.

    The History Cleanup task deletes entries in the following history tables in the SQL Server msdb database: backupfile, backupfilegroup, backupmediafamily, backupmediaset, backupset, restorefile, restorefilegroup, restorehistory not the txt file at the OS level.

  • Sorry, I was misremembering.

    Here's the doc: http://technet.microsoft.com/en-us/library/ms345177.aspx, are the files in the same folder? Meaning that you've selected the folder where the maint logs are written? I'd double check someone hasn't changed things.

    Also, are you going on the last updated date of the files? There are files that are beyond the date?

    Does it work if you run it interactively from SSMS? I'd run profiler and check the code being run. It should run an xp_delete_file to remove the files.

    Also, there was a time issue with SP2. Be sure that you're 1 Month by changing, saving, changing back. There were issues where things moved and it could end up being 1 year instead.

  • I think that there is a known bug in the Maintenance Plans related to this.

    http://support.microsoft.com/kb/938085

    It looks like it's fixed in cumulative update package 2.

    Ola Hallengren

    http://ola.hallengren.com

Viewing 5 posts - 1 through 4 (of 4 total)

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