Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

recursively invoking dbms_scheduler gives ORA-27478 error

551365Apr 14 2008 — edited Apr 22 2008
Hi Friends,

Please help me.

In a package I have 2 procedure.
One is a scheduler procedure and the other is the master procedure.
Master procedure has business logic in it.
In certain condition it needs to schedule itself by calling the scheduler procedure. This thing happen in a loop manner recursively and it fails to schedule at 2nd attempt with error :
ORA-27478: job "EASY.EASY_SCHEDULE" is running

I am pasting the portion of the package.

CREATE OR REPLACE PACKAGE ALERT_PACK AS

PROCEDURE short_schedule(p_short_sleep IN PLS_INTEGER);
PROCEDURE start_alert;

END ALERT_PACK;
/

CREATE OR REPLACE PACKAGE BODY ALERT_PACK AS

e_job_DOES_NOT_EXISTS EXCEPTION;
PRAGMA EXCEPTION_INIT(e_job_DOES_NOT_EXISTS,-27475);

PROCEDURE short_schedule(p_short_sleep IN PLS_INTEGER) IS

BEGIN
-- dropping job if exists previously
BEGIN
DBMS_SCHEDULER.drop_job('EASYTRIEVE_ALERT');
EXCEPTION
WHEN e_job_DOES_NOT_EXISTS THEN
NULL;
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END;

DBMS_SCHEDULER.create_job(job_name => 'ALERT_SCHEDULE',
job_type => 'STORED_PROCEDURE',
job_action => 'ALERT_PACK.start_alert',
start_date => SYSTIMESTAMP+NUMTODSINTERVAL(p_short_sleep,'MINUTE'),
repeat_interval => NULL ,
end_date => NULL,
enabled => TRUE,
auto_drop => FALSE);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
RAISE;
END short_schedule;

PROCEDURE start_alert IS
v_count PLS_INTEGER;
BEGIN
-- v_count is the number of files to be put in a directory.
IF v_count <=0 THEN

short_schedule(2);
-- count =1 shows that a valid file has arrived and start processing it.
ELSEIF v_count =1 THEN
null;
-- Do logic processing here;
END IF;

END start_alert;

END ALERT_PACK;
/


This scheduler creates a job with name "ALERT_SCHEDULE".
it needs to check the v_count after 2 minutes.
So if the count is 1, then do processing.
If count = 0 then schedule the job to check after 2 min.

You just need to run it once and it will run for ever and check for files by rescheduling itself.
1st time it ran ok, but failed to reschedule itself after 2 min and gave below error.

ORA-27478: job "EASYTRIEVE.EASYTRIEVE_A
LERT" is running


Please some one help.

Cheers.

Amaresh
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 20 2008
Added on Apr 14 2008
2 comments
1,351 views