April 24, 2009 at 11:01 pm
Hi,
I have a job which sends the daily report by fetching the information from the Database, some times the sql job is running for long time and it will not send the mail by fetching the information, at that i have to restart the SQL Server and SQL Server Agent manually and then it works.
Now i would like to check if any of the sql job is running for long time and restart both SQL Server and SQL Server agent so that my job of restarting the services manually will be automated.
With Regards
Dakshina Murthy
April 24, 2009 at 11:09 pm
This article will help you identify the long running jobs. Although, you should probably do some more troubleshooting and look for any blocking before restarting SQL Server. You really shouldn't have to restart SQL Server to make a job run.
April 24, 2009 at 11:21 pm
Thanks a lot i will check with this, sorry for asking how to restart the sql server, i would like to restart the sql sever agent.
With Regards
Dakshina Murthy
April 25, 2009 at 8:26 am
Another option is to check the SYSJOBHISTORY system table, but there is a trick to use it.
The sysjobhistory record is created only when a job STEP finish, so you can add a FIRST STEP in you job (a FAKE step).
For example: SELECT GETDATE() as a first step.
So, you can JOIN system tables and get the running elapsed time.
---------------------
Alex Rosa
http://www.keep-learning.com/blog
April 26, 2009 at 10:50 pm
Hey,
Thanks a lot for the reply, i will try working on this, Thanks for the input once again.
With Regards
Dakshina Murthy
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply