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


sysJobActivity showing jobs from years ago that never ended


sysJobActivity showing jobs from years ago that never ended

Author
Message
RossRoss
RossRoss
Old Hand
Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)

Group: General Forum Members
Points: 337 Visits: 763
durai nagarajan (5/21/2013)
Any problem in using Job Activity Monitor provided in sqlagent?.

Nope, Job Activity Monitor works fine, and it doesn't show these old jobs, but I would like to build my own queries around the job tables to make monitoring more flexible.



homebrew01 (5/21/2013)
I just filter them out of my query and ignore them.

Yeah I've resorted to this too, our longest job is a few hours, so I've been filtering out anything older than 1 day by using:
start_execution_date >= DATEADD(dd, -1, GETDATE())



I would still like to understand this though, and clean it up if possible without breaking things. I don't see that it would break anything, but being a production server I'm hesitant to do things I'm not 100% sure about.
durai nagarajan
durai nagarajan
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1629 Visits: 2775
it doesn't show these old jobs


what do you mean by this?

These jobs are not there now or you want job history details or others?

Regards
Durai Nagarajan
RossRoss
RossRoss
Old Hand
Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)

Group: General Forum Members
Points: 337 Visits: 763
durai nagarajan (5/22/2013)
it doesn't show these old jobs


what do you mean by this?

These jobs are not there now or you want job history details or others?


I mean it doesn't show the instances of the old jobs from several years ago, which is fine because I'm not too bothered about Job Activity Monitor anyway.

For example a job which runs daily and is in sysjobactivity as starting in 2010 but never finished will just show as normal for it's day to day routine in Job Activity Monitor. If it ran this morning and succeeded, then Job Activity Monitor say's it succeeded and the last run date was this morning. There is no mention of the 2010 instance of it in Job Activity Monitor.

The real questions I'm getting at though, are why have these old jobs never been marked with an end date, and can I delete these old entries from sysJobActivity, or UPDATE them with an end date of a long long time ago, so that they will never play into any queries. Can anyone think of anything that might break by doing this?
durai nagarajan
durai nagarajan
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1629 Visits: 2775

For example a job which runs daily and is in sysjobactivity as starting in 2010 but never finished will just show as normal for it's day to day routine in Job Activity Monitor. If it ran this morning and succeeded, then Job Activity Monitor say's it succeeded and the last run date was this morning. There is no mention of the 2010 instance of it in Job Activity Monitor.


You can find the job run status , job start date , job start time and Duration with much more information here in sysjobhistory.

Job Activity Monitor takes and shows the information from here. have you tried right click and check "View History" which will give more information.

History table will have few records operated by settings set in agent properties , history.

hope this will be useful.

Regards
Durai Nagarajan
Sean Pearce
Sean Pearce
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1802 Visits: 3432
Ross.M (5/14/2013)
So my questions are:
(1) What might have caused this?
(2) Is it safe to just do an UPDATE on these records and change the stop_execution_date to something like '1900-01-01'
(3) Are there any better ways to tidy this up?


You can tidy this up by scripting the job as drop and create.



The SQL Guy @ blogspot

@SeanPearceSQL

About Me
RossRoss
RossRoss
Old Hand
Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)

Group: General Forum Members
Points: 337 Visits: 763
durai nagarajan (5/22/2013)

For example a job which runs daily and is in sysjobactivity as starting in 2010 but never finished will just show as normal for it's day to day routine in Job Activity Monitor. If it ran this morning and succeeded, then Job Activity Monitor say's it succeeded and the last run date was this morning. There is no mention of the 2010 instance of it in Job Activity Monitor.


You can find the job run status , job start date , job start time and Duration with much more information here in sysjobhistory.

Job Activity Monitor takes and shows the information from here. have you tried right click and check "View History" which will give more information.

History table will have few records operated by settings set in agent properties , history.

hope this will be useful.


sysJobHistory does not show anything that is currently running, data is only stored here after the job step completes, which is why I'm looking at sysJobActivity:

http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSJOBHISTORY_TSQL);k(SQL11.SWB.TSQLRESULTS.F1);k(SQL11.SWB.TSQLQUERY.F1);k(MISCELLANEOUSFILESPROJECT);k(DevLang-TSQL)&rd=true
RossRoss
RossRoss
Old Hand
Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)

Group: General Forum Members
Points: 337 Visits: 763
Sean Pearce (5/23/2013)
Ross.M (5/14/2013)
So my questions are:
(1) What might have caused this?
(2) Is it safe to just do an UPDATE on these records and change the stop_execution_date to something like '1900-01-01'
(3) Are there any better ways to tidy this up?


You can tidy this up by scripting the job as drop and create.


Hi Sean, not sure I know what you mean?
Sean Pearce
Sean Pearce
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1802 Visits: 3432
Ross.M (5/23/2013)
Sean Pearce (5/23/2013)
Ross.M (5/14/2013)
So my questions are:
(1) What might have caused this?
(2) Is it safe to just do an UPDATE on these records and change the stop_execution_date to something like '1900-01-01'
(3) Are there any better ways to tidy this up?


You can tidy this up by scripting the job as drop and create.


Hi Sean, not sure I know what you mean?

Right click your job in SSMS
Script Job as -->
DROP And CREATE To -->
New Query Editor Window

Execute the script.



The SQL Guy @ blogspot

@SeanPearceSQL

About Me
RossRoss
RossRoss
Old Hand
Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)Old Hand (337 reputation)

Group: General Forum Members
Points: 337 Visits: 763
Sean Pearce (5/23/2013)
Right click your job in SSMS
Script Job as -->
DROP And CREATE To -->
New Query Editor Window

Execute the script.


Wouldn't this remove all of the job's history?
Sean Pearce
Sean Pearce
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1802 Visits: 3432
Ross.M (5/23/2013)
Sean Pearce (5/23/2013)
Right click your job in SSMS
Script Job as -->
DROP And CREATE To -->
New Query Editor Window

Execute the script.


Wouldn't this remove all of the job's history?

Yes, it would by default. You can specify @delete_history = 0 when deleting the job but the newly created job would have a different job_id. In an earlier post you specified
I'm looking for jobs that are currently running
which doesn't need any history.



The SQL Guy @ blogspot

@SeanPearceSQL

About Me
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