Job run history
When to use it
Every morning to see whether jobs failed overnight, and when someone asks if and when a job ran.
Run this
Script: 03_show_job_details.sql. Full version in Administration › Scheduler management › Scheduler status.
ACCEPT JOB_NAME PROMPT 'Enter job name pattern (% for all): ' DEFAULT '%'
ACCEPT HOURS_BACK PROMPT 'Enter hours to look back [1]: ' DEFAULT '1'
SET LINES 150 PAGES 100
COL owner FORMAT A20
COL job_name FORMAT A20
COL status FORMAT A12
COL actual_start_date FORMAT A20
COL run_duration FORMAT A20
SELECT
j.owner,
j.job_name,
j.job_action,
r.status,
TO_CHAR(r.actual_start_date, 'DD/MM/YYYY HH24:MI:SS') actual_start_date,
r.run_duration,
r.error#,
r.additional_info
FROM
dba_scheduler_jobs j
JOIN
dba_scheduler_job_run_details r
ON j.owner = r.owner
AND j.job_name = r.job_name
--WHERE j.job_action LIKE '%dbms_refresh.refresh%'
WHERE j.job_name LIKE '%&JOB_NAME%'
AND r.actual_start_date >= SYSDATE - INTERVAL '&HOURS_BACK' HOUR
ORDER BY
r.actual_start_date DESC;
UNDEFINE JOB_NAME
UNDEFINE HOURS_BACK
How to read the output
- The script asks for a job name pattern and how many hours to look back. Use
%and24for a general morning check. statusshould beSUCCEEDED.FAILEDandSTOPPEDneed a look.error#is the ORA error number, andadditional_infohas the message.run_durationlets you compare today with previous runs of the same job.
What to do next
- For a failed job, copy the error and the job name and send them to the owner of the job.
- A job that fails repeatedly can be marked
BROKENby the scheduler and stop running. See the next page. - Do not rerun a failed job without asking. Some jobs are not safe to run twice.
Risk level
READ ONLY Safe to run at any time. It only queries the data dictionary.