question

Steve Jones - Editor avatar image
Steve Jones - Editor asked

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?

sql-agentjob
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

James Moore avatar image James Moore commented ·
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.
0 Likes 0 ·
Mansour Shoari avatar image
Mansour Shoari answered

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 …

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image
Kev Riley answered

You can also call the stored procedure sp_purge_jobhistory

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.