SQL> shutdown abort .com

About DBA Queries DBA Scripts Quick Guides Other Stuff Contact
Andy only 
 

dba_jobs

Name           Null?    Type
-------------- -------- -----------------
JOB            NOT NULL NUMBER
LOG_USER       NOT NULL VARCHAR2(30)
PRIV_USER      NOT NULL VARCHAR2(30)
SCHEMA_USER    NOT NULL VARCHAR2(30)
LAST_DATE               DATE
LAST_SEC                VARCHAR2(8)
THIS_DATE               DATE
THIS_SEC                VARCHAR2(8)
NEXT_DATE      NOT NULL DATE
NEXT_SEC                VARCHAR2(8)
TOTAL_TIME              NUMBER
BROKEN                  VARCHAR2(1)
INTERVAL       NOT NULL VARCHAR2(200)
FAILURES                NUMBER
WHAT                    VARCHAR2(4000)
NLS_ENV                 VARCHAR2(4000)
MISC_ENV                RAW(32)
INSTANCE                NUMBER
Lists all jobs in the database. For example...
set lines 100
col	schema_user format a15
col	fails format 999
select	job
,	schema_user
,	to_char(last_date, 'hh24:mi dd/mm/yy') last_run
,	to_char(next_date, 'hh24:mi dd/mm/yy') next_run
,	failures fails
,	broken
,	substr(what, 1, 15) what
from	dba_jobs
order by 4
/
...gives the following on my test database:
JOB SCHEMA_USER     LAST_RUN       NEXT_RUN       FAILS B WHAT
--- --------------- -------------- -------------- ----- - ----------------
  2 PERFSTAT        11:00 20/01/08 12:00 20/01/08     0 N statspack.snap;
 38 PERFSTAT        14:53 19/01/08 14:53 20/01/08     0 N stats_purge;
The failures column, rather unsurprisingly, shows how many times the job has failed to run successfully. If the job fails to run more than 16 times it will be set to broken. If that happens you will need to run the following to reset it (after fixing the problem obviously):
exec dbms_job.broken(, FALSE);
To remove an unwanted job completely use this command:
exec dbms_job.remove();


For more useful DBA queries click here.

Copyright© 2007-2012 Andrew Barry