Scheduled jobs appears in two places in Oracle 10g, in the dba_scheduler_jobs (for automatic jobs and jobs scheduled via dbms_scheduler) as well as in the dba_jobs views for jobs that were scheduled with the dbms_job package.
The O'Reilly book on PL/SQL Built-in Packages: notes an automatic procedure for "fixing" special types of broken jobs:
The Oracle documentation suggests that fixing "disabled" jobs in 10g dbms_scheduler is different from the "broken" in dbms_job (emphasis added) and adds many "state" column values for jobs in dba_scheduler_jobs: select state from dba_scheduler_jobs;
Also, note this on dbms_scheduler.
Finally, Dr. Hall notes about the "state" column of dba_scheduler_jobs:
A regular failure doesn't alter the state column. We can prove this by creating a procedure that fails and scheduling it: CREATE OR REPLACE PROCEDURE proc_fail AS
BEGIN RAISE_APPLICATION_ERROR(-20000, 'I forced this error!'); END; / BEGIN DBMS_SCHEDULER.create_job( job_name => 'test1', job_type => 'PLSQL_BLOCK', job_action => 'BEGIN proc_fail; END;', repeat_interval => 'freq=minutely;', enabled => TRUE, start_date => SYSTIMESTAMP); END; / If we let it run a few times we can see that the state column stays as SCHEDULED, even after failures. You can check this using the following query: SELECT job_name, state FROM dba_scheduler_jobs WHERE job_name = 'TEST1'; As you say, you can check the details of the failures by querying the DBA_SCHEDULER_JOB_RUN_DETAILS view. The possible values for the STATE column vary a little, depending on the database version, but here is the state list for 10gR2.
Here is a query shows which dbms_scheduler jobs failed and why they failed:
-- What scheduled tasks failed during execution, and why? COL log_id FORMAT 9999 HEADING 'Log#' COL log_date FORMAT A32 HEADING 'Log Date' COL owner FORMAT A06 HEADING 'Owner' COL job_name FORMAT A20 HEADING 'Job' COL status FORMAT A10 HEADING 'Status' COL actual_start_date FORMAT A32 HEADING 'Actual|Start|Date' COL error# FORMAT 999999 HEADING 'Error|Nbr' TTITLE 'Scheduled Tasks That Failed:' select status <> 'SUCCEEDED' order by actual_start_date; |
Monday, July 23, 2018
Fixing Oracle broken jobs
Subscribe to:
Post Comments (Atom)
How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...
-
Alert: After SAN Firmware Upgrade, ASM Diskgroups ( Using ASMLIB) Cannot Be Mounted Due To ORA-15085: ASM disk "" has inconsiste...
-
Installing QLogic drivers on CentOS Linux hosts I have a couple of hosts in my lab with QLA2342 HBAs, and use the drivers from QLogic ins...
-
7 Important CellCLI Commands for Exadata DBA Now you are an Exadata DBA and I suppose you know Exadata basic Components and Feature...
No comments:
Post a Comment