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
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3453 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
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29284 Visits: 9222
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
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3453 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
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15206 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
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3453 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
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15206 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-Enthusiastic
SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)

Group: General Forum Members
Points: 172 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
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10800 Visits: 2078
Thanks Pradeep you are genious.

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

Group: General Forum Members
Points: 62295 Visits: 12763
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