SET ECHO off
REM NAME:   TFSDBJBS.SQL
REM USAGE:”@path/tfsdbjbs”
REM ————————————————————————
REM REQUIREMENTS:
REM    SELECT on DBA_JOBS
REM ————————————————————————
REM PURPOSE:
REM    Lists all jobs that have been submitted to run in the
REM    local database job queue.
REM ————————————————————————
REM Main text of script follows:
 
set pagesize 80
ttitle –
  center  ‘List Submitted Jobs’ skip 2
 
col jid  format 999  heading ‘Id’
col subu format a10  heading ‘Submitter’     trunc
col secd format a10  heading ‘Security’      trunc
col proc format a20  heading ‘Job’           word_wrapped
col lsd  format a5   heading ‘Last|Ok|Date’ 
col lst  format a5   heading ‘Last|Ok|Time’
col nrd  format a5   heading ‘Next|Run|Date’
col nrt  format a5   heading ‘Next|Run|Time’
col fail format 999  heading ‘Errs’
col ok   format a2   heading ‘Ok’
 
select
  job                        jid,
  log_user                   subu,
  priv_user                  secd,
  what                       proc,
  to_char(last_date,’MM/DD’) lsd,
  substr(last_sec,1,5)       lst,
  to_char(next_date,’MM/DD’) nrd,
  substr(next_sec,1,5)       nrt,
  failures                   fail,
  decode(broken,’Y’,’N’,’Y’) ok
from
  sys.dba_jobs
/