SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Agent Job History Retention


SQL Agent Job History Retention

Author
Message
anzz
anzz
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4959 Visits: 719
On Sql server 2005 & 2008, we are getting only like 4-5 days worth for Job History Retention.
But we need like 4 weeks of SQL Agent Job History Retention.

I am doing like going SSMS --> SQL Server Agent Properties --> history--> enabling automatically remove agent history older then 4 weeks-> click OK.

again if I open the properties. I don't see the enabled automatically remove agent history older then 4 weeks.

what was the issue? what should I must do set my history for 4 weeks.
homebrew01
homebrew01
SSC-Forever
SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)

Group: General Forum Members
Points: 49027 Visits: 9259
If you only have 4-5 days of history, then you need to increase the # of rows to retain on that same screen.



anzz
anzz
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4959 Visits: 719
Some job have like 4-5 history and some jobs don't have any history. So I want to set up at 4 weeks.
Adiga
Adiga
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24436 Visits: 21012
@ravz.sqldba, "Automatically remove agent history" option not remaining selected is a BUG which even I can reproduce. However when you select it and click ok, all data older than the selected duration (in your case 4 weeks) is deleted for one time.

Setting up a job which executed SP_PURGE_JOBHISTORY with the relevant parameters is a workaround.

Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
anzz
anzz
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4959 Visits: 719
@ Pradeep: I am not aware of SP_PURGE_JOBHISTORY.
what it will do. Is there any alternate solution of fixing the bug.
Adiga
Adiga
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24436 Visits: 21012
This article has the syntax for sp_purge_jobhistory. You may create a job which executes a query similar to the one below. This query deletes records older than 10 days.


DECLARE @oldestdate DATETIME
SET @oldest = GETDATE() - 10
EXEC SP_PURGE_JOBHISTORY @oldest_date = @oldestdate



Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
maryanne_e_2000
maryanne_e_2000
SSC Veteran
SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)

Group: General Forum Members
Points: 236 Visits: 16
Does this same stored procedure (msdb.dbo.sp_purge_jobhistory procedure) also clean up SQL Server Reporting Services subscriptions managed by the SQL Server Agent Jobs?

Thank you.

Best Regards,
Mary Anne
forsqlserver
forsqlserver
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16984 Visits: 2142
Thanks Pradeep you are genious.

Thanks
Eric M Russell
Eric M Russell
SSC Guru
SSC Guru (108K reputation)SSC Guru (108K reputation)SSC Guru (108K reputation)SSC Guru (108K reputation)SSC Guru (108K reputation)SSC Guru (108K reputation)SSC Guru (108K reputation)SSC Guru (108K reputation)

Group: General Forum Members
Points: 108399 Visits: 14551
Check your maintenance plan. Often times it will contain truncate job and backup history.


"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search