Search code examples
oracleplsqloracle11g

Oracle - DBMS_PARALLEL_EXECUTE failed with no error


I'm using for first time the DBMS_PARALLEL_EXECUTE pkg. I've try a simple operation: I've two table t1 and t2 and I'm tring to insert all the records of t2 into t1.

begin
  DBMS_PARALLEL_EXECUTE.create_task('myTsk1');
  DBMS_PARALLEL_EXECUTE.create_chuncks_by_rowid(task_name => 'myTsk1',
    table_owner => 'mySchema',
    table_name => 't2',
    bt_row => TRUE,
    chunk_size => 1000
  );
  DBMS_PARALLEL_EXECUTE.run_task(task_name => 'myTsk1',
    sql_stmt => 'insert /*+ parallel */ into mySchema.t1 (select * from mySchema.t2 where rowid between :start_id and :end_id)',
    language_flag => DBMS_SQL.NATIVE,
    parallel_leveò => 4
  );
end;

After the create_task and create_chuncks_by_rowid I see the job un chunked status in user_parallel_execute_task and in user_parallel_execute_chunks I see the chunks created.

When executed the run_task after few second the execution was completed. If I check in user_parallel_execute_task table all are set as UNASSIGNED.

So I checked the user_scheduler_job_run_details and all_scheduler_job_run_details for know the cause of the error but ERROR# column is 0 and ADDITIONAL_INFO is null. Added the exception trap but no exception was raised too.


Solution

  • As suggested @ConnorMcDonald by removing the parallel hint the task run correctly!

    begin
      DBMS_PARALLEL_EXECUTE.create_task('myTsk1');
      DBMS_PARALLEL_EXECUTE.create_chuncks_by_rowid(task_name => 'myTsk1',
        table_owner => 'mySchema',
        table_name => 't2',
        bt_row => TRUE,
        chunk_size => 1000
      );
      DBMS_PARALLEL_EXECUTE.run_task(task_name => 'myTsk1',
        sql_stmt => 'insert into mySchema.t1 (select * from mySchema.t2 where rowid between :start_id and :end_id)',
        language_flag => DBMS_SQL.NATIVE,
        parallel_leveò => 4
      );
    end;