A few days before, I just posted one article to check running scheduled jobs and I used master. dbo. xp_sqlagent_enum_jobs system objects and joined with dbo.sysjobs object from the msdb database for the same. Please read that post before moving down. This was one way to get the list of running jobs and now here I am sharing another alternate way to find same details. For this I am using dbo. sp_help_job objects from msdb database and @execution_status parameter to get the details. Let me share a script here,
@execution_status parameter status values are following for which you list out the jobs with that passed status,
0 - Returns only those jobs that are not idle or suspended.
1 - Executing.
2 - Waiting for thread.
3 - Between retries.
4 - Idle.
5 - Suspended.
7 - Performing completion actions.
You may be using this script to get job status. Please put your comments if any other alternate way you have other than these.
USE msdbAnd the result looks,
GO
–- 1- Executing
EXEC dbo.sp_help_job @execution_status = 1;
@execution_status parameter status values are following for which you list out the jobs with that passed status,
0 - Returns only those jobs that are not idle or suspended.
1 - Executing.
2 - Waiting for thread.
3 - Between retries.
4 - Idle.
5 - Suspended.
7 - Performing completion actions.
You may be using this script to get job status. Please put your comments if any other alternate way you have other than these.
No comments:
Post a Comment
Please Use Good Leanguage