Dbms_scheduler auto drop

  • From: Andrew Kerber <andrew.kerber@xxxxxxxxx>
  • To: Oracle-L Freelists <Oracle-L@xxxxxxxxxxxxx>
  • Date: Mon, 27 Apr 2015 10:37:53 -0500


Oracle 11.2.0.3 EE on Aix.

I have written a procedure that will create scheduler jobs based on an
argument, then run them. Going through the documentation, I determined that if
I want to run a scheduler job in a separate session when calling it from a
stored procedure, I had to first create the job disabled using
DBMS_SCHEDULER.CREATE_JOB, then use the DBMS_SCHEDULER.RUN_JOB procedure, and
set the argument USE_CURRENT_SESSION to FALSE.

However, I also want the drop to drop automatically once it has been run. To
accomplish this, I set the AUTO_DROP option to TRUE. According to the
documentation, since I did not set a repeat interval, it should drop the job
after a single run. However, the jobs that are generated from this SP do not
drop automatically. Below is the code segment that creates and runs the job.
Is there a change that will drop the job automatically. For now, I have
modified the code to drop jobs matching the naming convention at the start of
the job, but I would prefer that they were dropped automatically.

dbms_scheduler.create_job(
job_name=>'ASYNC_ANALYZE_'||to_char(analyze_cursor2.group_number),
job_type=>'PLSQL_BLOCK',
job_action=>'BEGIN
async_analyze_group('||analyze_cursor2.group_number||'); END;',
comments=>'Asynch analyze job for tables requiring special
attention. Argument is the group number from the stats_group table',
auto_drop=>true, --set this to false for debugging purposes, job
will remain on dba_scheduler_jobs view until manually removed
enabled=>false);

dbms_scheduler.run_job(job_name=>'ASYNC_ANALYZE_'||to_char(analyze_cursor2.group_number),use_current_session=>false);


Sent from my iPad--
//www.freelists.org/webpage/oracle-l


Other related posts: