• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

how would I write a t-script to view all the errors in my maintenance plan history and agent Job History?

I am needing a script that will view all the errors in my SQL servers maintenance history and Agent job history. How can I do this? and what would the script be?
0
Steve Samson
Asked:
Steve Samson
  • 4
  • 3
2 Solutions
 
jorge_torizCommented:
SELECT * FROM sysjobhistory
0
 
jorge_torizCommented:
Well, you will need the sysjobs_view view too
0
 
Steve SamsonAuthor Commented:
What about the maintenance plan history?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jorge_torizCommented:
The maintenance plan is built on tasks of SQL Server Agent, through this views you can get the history of your maintenance plan
0
 
Steve SamsonAuthor Commented:
This is the final script I think this will do it thanks for your help Jorge_toriz

select a.Name, a.Originating_Server, a.Job_id, b.Step_Name, b.Sql_Severity, b.[Message] from msdb.dbo.sysjobs_view a, msdb.dbo.sysjobhistory b
where a.job_id=b.job_id and message like'%failed%'
0
 
Steve SamsonAuthor Commented:
Some times it helps to look out side of the imediate problem to find a solution.
0
 
jorge_torizCommented:
:)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now