September 9, 2004 at 10:44 am
we have in our Maintenance plan to remove trn files older day1 but logs are not clearing in backup directoy.what to do tofix this problem.
Thanks in advance
September 9, 2004 at 3:40 pm
Hello,
Please create a job with a Job Step that is of Type ActiveX script and Language VBscript. Then enter a script that uses FileSystemObject See the example of the script at
http://www.enterpriseitplanet.com/resources/scripts_win/article.php/3081721
It is exactly your task, it says:
'
' Script to delete files older than a given number of days.
'
Do not forget to specify your number of days. Or better ask your friend the developer to check the script out.
We are using similar job step and our own script to delete old files in the backup directory. You may modify their script to include checking for file extension or file size something like that (this is just part of the script...):
For each MyFile In objFolder.Files
If UCase(Right(MyFile.name,4)) = ".LOG" then
If ABS(DateDiff("n", now , MyFile.DateCreated)) > PredefinedMinutes then
If MyFile.Size > fileMinSize then
' Do Your Processing Here......
Exit For
End If
End If
End If
Next
Regards,Yelena Varsha
September 10, 2004 at 4:23 am
Are they really old logs? Maybe SQL Server doesnt even know they exist. The Maintenance Plans dont look at the disk to see what files are there, they use the msdb.sysbackupmedia table.
Does SQL Server (and SQL Server Agent) have permission to delete the files?
Maybe just delete everything out of the directory and then see how the maintenance plans go after a few days.
Julian Kuiters
juliankuiters.id.au
September 13, 2004 at 6:47 am
Check that your maintenance plan is not including databases that have simple recovery model. Tlog backup step occurs before tlog cleanup step, so tlog backup step will fail for simple recovery db's which prevents the tlog cleanup step from running.
Jeff
September 13, 2004 at 6:50 pm
If the current log files are not getting deleted, try re-creating the maintenance plan.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply