Delete log files created by Maintenace Plan

In C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log there are log files created not everyday but may be two or 3 per day. I am guessing the log files were created while building the maintenance plan. Is it possible to delete some of the old logs? Can it also be deleted automatically?
more ▼

asked Jul 25 at 02:15 PM in Default

chitrarekha.saha gravatar image

666 24 38 46

Which logs are you referring to? There are a couple of things that probably default logging in that directory, such as the SQL Agent as well as the error log. Both should be able to be cleaned up in some fashion.
Jul 27 at 02:20 PM JohnM
This web site runs on voting. Please indicate all helpful answers by clicking on the thumbs up next to those answers. If any one answer lead to a solution, please indicate this by clicking on the check mark next to that answer.
Aug 04 at 10:35 AM Grant Fritchey ♦♦
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

alt text

error_log.png (12.5 kB)
more ▼

answered Jul 28 at 03:29 PM

chitrarekha.saha gravatar image

666 24 38 46

Just providing a screenshot is not much of an answer. Might want to show how you got to that window.
Jul 28 at 03:47 PM Shawn_Melton
Rt click on Maintenance place Full backup, click on reporting and logging on the top of the maintenance plan (Fullbackup).
Jul 28 at 05:06 PM chitrarekha.saha
(comments are locked)
10|1200 characters needed characters left

If there are no options within the maintenance plan to automatically clean out those logs, then you'll have to build your own. I'd suggest using SQL Agent and PowerShell to run a script that deletes files older than a certain date. You can use a script similar to this one. I would absolutely make sure you only delete the log files that you are generating though. You don't want to delete files that are important.

more ▼

answered Jul 29 at 11:59 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
103k 19 21 74

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jul 25 at 02:15 PM

Seen: 207 times

Last Updated: Aug 04 at 10:35 AM