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
 Any easier way of view Agent log?

Author  Topic 

cddot
Starting Member

37 Posts

Posted - 2009-05-14 : 05:51:20
When a SQL Agent jobs fails, it says to look at history log for more details.

When viewing history, there is some information in the "messages" field but you need to widen that field to read the information.

Is there an easier way of doing this? Is the log information stored somewhere else that can be accessed more easily?

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-05-14 : 05:54:46
Google should be your friend!

http://technet.microsoft.com/en-us/library/ms181367(SQL.90).aspx

In particular
sysjobstepslogs
Contains information about job step logs.

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-05-14 : 06:00:35
(it's in the msdb database btw)

example :

SELECT * FROM msdb.dbo.sysjobactivity



Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

cddot
Starting Member

37 Posts

Posted - 2009-05-14 : 06:03:23
Well, it can be debatable whether writing SQL to query system tables can be classified as "accessed more easily".

But sure, it's one way of doing it and not terribly difficult if you are comfortable with SQL, but if I may rephrase my question - there a nice friendly one-click (or at least not-many clicks) button way of doing it?

PS: Thanks for the pointer about those sysjob* tables.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-05-14 : 07:58:17
Ah -- I see.

The interface through enterprise manager is a little clunky I agree.

There's an export button under the history panel but it's still a little unweildy

Does this SQL give you what you need to know?

SELECT
sj.[name]
, sjh.[message]
, sjh.[run_Date] AS [Run Date]
, sjh.[run_Time] AS [Run Time]
FROM
msdb.dbo.sysJobHistory sjh
JOIN msdb.dbo.sysJobs sj ON sj.[job_Id] = sjh.[job_Id]
WHERE
[run_status] = 0


If so you could incorporate that into a view or stored proc and then all you would have to do is query the view or run the stored proc -- both of those options only require 1 or 2 clicks.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -