How to use DBMS_JOB?


 have submitted and commited the following job (logged on as myself, having
DBA-role):
 sys.dbms_job.submit(jobno, 'BEGIN SYS.DBMS_UTILITY.ANALYZE_SCHEMA(''L6'',
''COMPUTE''); END;', SYSDATE, 'TRUNC(SYSDATE+1)');

The job is in the queue, but failes. Why?
I have tried to run it immediately, calling dbms_job.run. Result:
ORA-12011: Execution of 1 jobs failed.
ORA-06512: at "SYS.DBMS_IJOB", line 255
ORA-06512: at "SYS.DBMS_JOB", line 219
ORA-06512: at line 2

When I run the script directly, it works OK
BEGIN
    SYS.DBMS_UTILITY.ANALYZE_SCHEMA(''L6'', ''COMPUTE'');
END;

What am I missing??

Audun



Ans1:

You don't need the BEGIN/END in the job to execute, just the package to
call with parameters....

SQL> exec sys.dbms_job.submit(jobno,
'SYS.DBMS_UTILITY.ANALYZE_SCHEMA(''L6'',''COMPUTE'')', SYSDATE,
'TRUNC(SYSDATE+1)');

Graham



Ans2:

From the Messages and Codes manual:

   ORA-12011 execution of num jobs failed

 Cause:  Some kind of error was caught in DBMS_IJOB.RUN. One or more
jobs that were due to be run produced errors that they could not
handle.

Action: Look at the alert log for details on which jobs failed and
why.
 
 

Hosted by www.Geocities.ws

1