Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQLagent job name

Author  Topic 

shiyam198
Yak Posting Veteran

94 Posts

Posted - 2013-05-24 : 10:43:04
Hi,

One of our DB server has several SQLagent jobs. I wanted to check the status of a backup and ran SP_whoisactive. It gave me the details which included "Program_name" which was cryptic:


SQLAgent - TSQL JobStep (Job 0x342E6E3096634D47B0C2308A83DF70B2 : Step 3)


Since there are many SQL agent jobs on the server, I wanted to find which job it's running so I can check what is step 3 and how many steps more to finish.

So, I used the following to get the ID for all the SQL agent jobs.


select * from msdb.dbo.sysjobs


But None of the job_IDs match the ID I got above. Shouldn't atleast one job match the result I got above "0x342E6E3096634D47B0C2308A83DF70B2".

Am I missing something here?

Any help is much appreciated

- Shiyam

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-05-24 : 11:10:50
Try this command:

[CODE]

Select * from msdb.dbo.sysjobhistory

[/CODE]

http://msdn.microsoft.com/en-us/library/ms174997.aspx
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2013-05-24 : 11:21:40
I would modify MuMu's suggestion to this:
select top 100 * from sysjobhistory order by run_date desc;

Can also try this:
use msdb;
go

SELECT j.name, s.step_id
FROM sysjobs j
JOIN sysjobsteps s
On s.job_id = j.job_id
WHERE command like '%backup%';
Go to Top of Page

shiyam198
Yak Posting Veteran

94 Posts

Posted - 2013-05-24 : 12:17:51
Thanks a MILLION guys!
Go to Top of Page
   

- Advertisement -