October 14, 2005 at 3:49 am
Hi,
Can any one out there help me?
In the past we have had jobs that have overrun / locked up and generally caused the server to perform very slowly. Our plan is to work out the average time each step of a job should be finished by and then send an alert if that step of the job is over running.
First part is ok to do (sysjobs and sysjobhistory).
The next part I’m reaching for the prozac on.
The only way I can think of (to avoid jobs that only have one step and therefore wouldn’t be in sysjobhistory) is to look at sysprocesses.
Now comes the problem, I can get the job id as char from program_name and call it @JobId (in this case 0xA2D8A688CA6DBA4F928364C24BB97B2D, the value in sysjobs is 88A6D8A2-6DCA-4FBA-9283-64C24BB97B2D) but what conversion do I need to run the following:
select * from msdb..sysjobs where job_id = @JobId
All conversions I’ve tried have resulted in a conversion error.
Is the conversion possible or am I wasting my time?
Any thoughts on this would be greatly appreciated.
Regards
Stuart
-------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
October 14, 2005 at 6:03 am
I can't answer your conversion question, but I was faced with a similar problem a few months ago. What we decided to do was to add an additional step at the beginning of each job which simply does a SELECT 1
The step runs instantly, hense ensuring that every running job has an entry in sysjobhistory.
It's a bit time-consuming to go through all jobs an add a step (give the task to the junior ) but you save in that it's very easy to see if a job is still executing (has a record in sysjobhistory for job step 1, but not for job step 0)
HTH
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 14, 2005 at 6:14 am
Thanks for the idea - I'll give it a go
-------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
October 14, 2005 at 7:34 am
http://www.databasejournal.com/features/mssql/article.php/3500276
This reports on long running jobs but it will give you what you are looking for
Far away is close at hand in the images of elsewhere.
Anon.
October 19, 2005 at 1:12 am
That's just what I was after - many thanks
-------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply