Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Friday, March 23, 2012

Job running status

In SQL 2000, go to Management, than Jobs, you will see a list of all jobs and their running status. I would like to programmatically display the same on my web page. I can call sysjobs table to get the jobs and use sysjobschedules to determine whether it's been scheduled or not. Then use sysjobhistory to obtain their running history. But how and where do I get the Next Run Date information? Is this calculated or stored somewhere?

Can anyone give me some help on how to work with sysjobs, sysjobschedules, and sysjobhistory tables? All I am trying to do is to build a web-based app that does the same thing as the Enterprise Manager is doing - create and schedule a job, and monitor the job status.

Thanks a lot!

Penn

Performing query directly to system tables is not recommended, as the schema of system tables/views may change even between different builds. Instead, you can use some system procedures to get detailed information about agent jobs, for example:

exec msdb..sp_help_job @.job_name='Expired subscription clean up'

So you can call such system procedures from your code using SqlDataAdapter and then fill the result sets into DataSet for future using. For more information about system procedures, please refer to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_00_519s.asp

Wednesday, March 21, 2012

Job History is not showing

Using Sql 2005, I have a job that will not display job history when it runs
at the schedule time. It will show job history if you manually run the job.
Any thoughts?
Are you sure that the history settings are not such that it gets purged by
the time you view it?
Andrew J. Kelly SQL MVP
"Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
> Using Sql 2005, I have a job that will not display job history when it
> runs
> at the schedule time. It will show job history if you manually run the
> job.
> Any thoughts?
|||The Limit Size of Job History Log is checked with Max Log size of 1000 and
Max Job history is 105. When I looked at the job history for all it showed
only 212 entries.
This particular server is the distributor. The only jobs on the server that
do show history deal with the replication.
"Andrew J. Kelly" wrote:

> Are you sure that the history settings are not such that it gets purged by
> the time you view it?
> --
> Andrew J. Kelly SQL MVP
> "Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
> news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
>
>
|||OK my guess is that the history limit is beeing exceeded by one of the jobs
that runs say every minute or so. You can try bumping up the history limits
but it depends on how often the other jobs run.
Andrew J. Kelly SQL MVP
"Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
news:A1B7DE7A-B3CD-4C05-B971-46A00161624B@.microsoft.com...[vbcol=seagreen]
> The Limit Size of Job History Log is checked with Max Log size of 1000 and
> Max Job history is 105. When I looked at the job history for all it
> showed
> only 212 entries.
> This particular server is the distributor. The only jobs on the server
> that
> do show history deal with the replication.
> "Andrew J. Kelly" wrote:

Job History is not showing

Using Sql 2005, I have a job that will not display job history when it runs
at the schedule time. It will show job history if you manually run the job.
Any thoughts?Are you sure that the history settings are not such that it gets purged by
the time you view it?
Andrew J. Kelly SQL MVP
"Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
> Using Sql 2005, I have a job that will not display job history when it
> runs
> at the schedule time. It will show job history if you manually run the
> job.
> Any thoughts?|||The Limit Size of Job History Log is checked with Max Log size of 1000 and
Max Job history is 105. When I looked at the job history for all it showed
only 212 entries.
This particular server is the distributor. The only jobs on the server that
do show history deal with the replication.
"Andrew J. Kelly" wrote:

> Are you sure that the history settings are not such that it gets purged by
> the time you view it?
> --
> Andrew J. Kelly SQL MVP
> "Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
> news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
>
>|||OK my guess is that the history limit is beeing exceeded by one of the jobs
that runs say every minute or so. You can try bumping up the history limits
but it depends on how often the other jobs run.
Andrew J. Kelly SQL MVP
"Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
news:A1B7DE7A-B3CD-4C05-B971-46A00161624B@.microsoft.com...[vbcol=seagreen]
> The Limit Size of Job History Log is checked with Max Log size of 1000 and
> Max Job history is 105. When I looked at the job history for all it
> showed
> only 212 entries.
> This particular server is the distributor. The only jobs on the server
> that
> do show history deal with the replication.
> "Andrew J. Kelly" wrote:
>

Job History is not showing

Using Sql 2005, I have a job that will not display job history when it runs
at the schedule time. It will show job history if you manually run the job.
Any thoughts?Are you sure that the history settings are not such that it gets purged by
the time you view it?
--
Andrew J. Kelly SQL MVP
"Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
> Using Sql 2005, I have a job that will not display job history when it
> runs
> at the schedule time. It will show job history if you manually run the
> job.
> Any thoughts?|||The Limit Size of Job History Log is checked with Max Log size of 1000 and
Max Job history is 105. When I looked at the job history for all it showed
only 212 entries.
This particular server is the distributor. The only jobs on the server that
do show history deal with the replication.
"Andrew J. Kelly" wrote:
> Are you sure that the history settings are not such that it gets purged by
> the time you view it?
> --
> Andrew J. Kelly SQL MVP
> "Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
> news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
> > Using Sql 2005, I have a job that will not display job history when it
> > runs
> > at the schedule time. It will show job history if you manually run the
> > job.
> >
> > Any thoughts?
>
>|||OK my guess is that the history limit is beeing exceeded by one of the jobs
that runs say every minute or so. You can try bumping up the history limits
but it depends on how often the other jobs run.
--
Andrew J. Kelly SQL MVP
"Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
news:A1B7DE7A-B3CD-4C05-B971-46A00161624B@.microsoft.com...
> The Limit Size of Job History Log is checked with Max Log size of 1000 and
> Max Job history is 105. When I looked at the job history for all it
> showed
> only 212 entries.
> This particular server is the distributor. The only jobs on the server
> that
> do show history deal with the replication.
> "Andrew J. Kelly" wrote:
>> Are you sure that the history settings are not such that it gets purged
>> by
>> the time you view it?
>> --
>> Andrew J. Kelly SQL MVP
>> "Cindy B" <CindyB@.discussions.microsoft.com> wrote in message
>> news:EE87736D-8DC0-4646-B67F-FF2477DF8ABA@.microsoft.com...
>> > Using Sql 2005, I have a job that will not display job history when it
>> > runs
>> > at the schedule time. It will show job history if you manually run the
>> > job.
>> >
>> > Any thoughts?
>>sql