Answered by:
SQL agent job history retention can not be set

Question
-
Hi All,
we've installed the SQL server 2008 R2 64bit, but when I try to access "SQL Server Agent" properties to set the history retention, it's failed. It doesnt reflect the changes made and goes back to the default settings.
Can you share your experience on that? for me it's very improtant.
Many thanks in advance.
Tuesday, August 13, 2013 12:30 AM
Answers
-
- Marked as answer by Human Being_001 Tuesday, August 13, 2013 5:40 AM
Tuesday, August 13, 2013 4:39 AM
All replies
-
Unfortunately there has been a bug with this in SSMS for quite a while and it appears that it hasn't been fixed. It only has 4 up-votes at the current time, which is pretty low, but definitely has an impact to those who encounter it. A workaround is provided in the Connect bug below and also in the threads below where people typically use the History Cleanup task in Maintenance Plans.
http://www.sqlservercentral.com/Forums/Topic1267858-1550-1.aspx
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.- Proposed as answer by RohitGarg Tuesday, August 13, 2013 4:17 AM
Tuesday, August 13, 2013 1:47 AM -
Hello,
As a "workaround" you can use the following T-SQL script / sp_set_sqlagent_properties to change the job history retention; in this sample to 2000 total/200 per job:
USE [msdb] GO EXEC msdb.dbo.sp_set_sqlagent_properties @email_save_in_sent_folder=1, @use_databasemail=1 GO USE [msdb] GO EXEC msdb.dbo.sp_set_sqlagent_properties @jobhistory_max_rows=2000, @jobhistory_max_rows_per_job=200, @email_save_in_sent_folder=1, @use_databasemail=1 GO
Olaf Helper
[ Blog] [ Xing] [ MVP]Tuesday, August 13, 2013 4:15 AM -
Thanaks for your prompt reply. For me, do you have t-sql to make sql server save 60 days ago histroy?
I saw your script it's doing increase job row.
Thanks.
Tuesday, August 13, 2013 4:21 AM -
- Marked as answer by Human Being_001 Tuesday, August 13, 2013 5:40 AM
Tuesday, August 13, 2013 4:39 AM -
Ok, I understand.Tuesday, August 13, 2013 5:40 AM