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!

Wait for dbms_scheduler.job to finish and prevent it from starting

adammsvkAug 22 2012 — edited Aug 22 2012
Hello everyone,

I have a DBMS_SCHEDULER's job scheduled to be executed every X seconds (parametrized). One run of the job may take from couple seconds if no data is available to couple minutes.

During a "maintenance" window, I would need to:
1. if the job is running then wait for it to finish gracefully (it may be running a long-running SQL). I need the job to finish properly.
2. then disable/drop it (prevent it from being executed)
3. now I do my maintenance stuff, DB export, whatever
4. after I'm done, I would like the job to be rescheduled again.

After going through documentation, I'm not entirely sure what DBMS_SCHEDULER.STOP_JOB does, quoting:
+If force is set to FALSE, the Scheduler tries to gracefully stop the job using an interrupt mechanism. This method gives control back to the slave process, which can update the status of the job in the job queue to stopped. If this fails, an error is returned.+

What does that mean in human language?

If I do something like this:
DBMS_SCHEDULER.STOP_JOB('MyJob', false);
DBMS_SCHEDULER.DROP_JOB('MyJob');
Is it going to let the job end gracefully or not?

Thank you,

Regards,
Adam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2012
Added on Aug 22 2012
3 comments
1,465 views