SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Job history only shows one entry for job
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Abu-Dina
Posting Yak Master

United Kingdom
199 Posts

Posted - 07/30/2012 :  07:29:24  Show Profile  Reply with Quote
Hi,

We have a problem where only the latest entry is displayed in the job history for a particular job. There are 14 jobs that run once day.

I've checked the history settings for the SQL Server Agent and it's configured to store a maximum of 1000 rows for all jobs and 100 row per job. The jobhistory table is full. I've increased the maximum size to 5000 rows but we're only interested in keeping the last three days’ worth of job history. Should I create another job to delete entries for this particular job that are more than 3 days old?

Thanks.

nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3328 Posts

Posted - 07/30/2012 :  08:50:24  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
I always copy job history into a table in another database and run that every hour or so. Often want to see what happened several days ago. Also shows yoou when someone changed a job.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Edited by - nigelrivett on 07/30/2012 08:50:50
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47157 Posts

Posted - 07/30/2012 :  12:46:16  Show Profile  Reply with Quote
quote:
Originally posted by Abu-Dina

Hi,

We have a problem where only the latest entry is displayed in the job history for a particular job. There are 14 jobs that run once day.

I've checked the history settings for the SQL Server Agent and it's configured to store a maximum of 1000 rows for all jobs and 100 row per job. The jobhistory table is full. I've increased the maximum size to 5000 rows but we're only interested in keeping the last three days’ worth of job history. Should I create another job to delete entries for this particular job that are more than 3 days old?

Thanks.


You've property in SQL server agent which enables you to determines till what times history you need to keep.
Its accessed by right clicking on sql server agent icon on object explorer in ssms and choosing properties. Select History tab and see remove agent history property. you can configure it to remove history older than set value of days\weeks from this.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Abu-Dina
Posting Yak Master

United Kingdom
199 Posts

Posted - 08/01/2012 :  04:25:56  Show Profile  Reply with Quote
quote:
Originally posted by visakh16


You've property in SQL server agent which enables you to determines till what times history you need to keep.
Its accessed by right clicking on sql server agent icon on object explorer in ssms and choosing properties. Select History tab and see remove agent history property. you can configure it to remove history older than set value of days\weeks from this.



Thanks Visakh. I've changed the setting to 3 days. Hopefully this should do the trick.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47157 Posts

Posted - 08/01/2012 :  09:33:08  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jeffw8713
Aged Yak Warrior

USA
696 Posts

Posted - 08/02/2012 :  14:25:28  Show Profile  Reply with Quote
quote:
Originally posted by visakh16
You've property in SQL server agent which enables you to determines till what times history you need to keep.
Its accessed by right clicking on sql server agent icon on object explorer in ssms and choosing properties. Select History tab and see remove agent history property. you can configure it to remove history older than set value of days\weeks from this.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Unfortunately - that property is not one that is persisted. In fact, using that property just runs the history cleanup at the time you click OK on the box.

The way to manage this is to remove the setting for number of rows (uncheck the box) - then setup a maintenance plan with the History Cleanup task in that plan. Set this up to run daily and set the properties of the task to keep as much history as you want.

If you don't like maintenance plans - you can view the t-sql from the history task and build your own...here is an example of the code from that task:


declare @dt datetime select @dt = cast(N'2012-02-02T13:23:38' as datetime) exec msdb.dbo.sp_delete_backuphistory @dt
GO
EXEC msdb.dbo.sp_purge_jobhistory  @oldest_date='2012-02-02T13:23:38'
GO
EXECUTE msdb..sp_maintplan_delete_log null,null,'2012-02-02T13:23:38'
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000