How do I clear job history from SQL Agent

My job history appears to be large, how do I clear it? Can I limit it's growth?

more ▼

asked Oct 30 '09 at 11:03 AM in Default

Steve Jones - Editor gravatar image

Steve Jones - Editor ♦♦
5.1k 76 79 82

Its quite important to do this. MSDB lacks indexes in may places and keeping the tables small can help improve performance of tools accessing items such as job history.
Oct 30 '09 at 11:51 AM James Moore
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Clearing: SQL Server Agent > Jobs > Select the Job > Right mouse click (View History) > Highlight one or more log file summary from the list > Delete

Limiting the growth: SQL Server Agent > Properties > History > Automatically remove agent history older than …

more ▼

answered Oct 30 '09 at 11:19 AM

Mansour Shoari gravatar image

Mansour Shoari
435 13 14 15

(comments are locked)
10|1200 characters needed characters left

You can also call the stored procedure sp_purge_jobhistory

more ▼

answered Oct 30 '09 at 11:49 AM

Kev Riley gravatar image

Kev Riley ♦♦
50.8k 43 49 76

Better still, schedule it to run periodically and keep things clean.
Oct 30 '09 at 02:28 PM Raj More
(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: Oct 30 '09 at 11:03 AM

Seen: 3383 times

Last Updated: Oct 30 '09 at 11:03 AM