SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQLagent job name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shiyam198
Yak Posting Veteran

94 Posts

Posted - 05/24/2013 :  10:43:04  Show Profile  Reply with Quote
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

547 Posts

Posted - 05/24/2013 :  11:10:50  Show Profile  Reply with Quote
Try this command:



Select * from msdb.dbo.sysjobhistory



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

russell
Pyro-ma-ni-yak

USA
5071 Posts

Posted - 05/24/2013 :  11:21:40  Show Profile  Visit russell's Homepage  Reply with Quote
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 - 05/24/2013 :  12:17:51  Show Profile  Reply with Quote
Thanks a MILLION guys!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000