oracle dbms_scheduler to run multiple procedures i

2019-06-08 08:26发布

I've trying to figure out oracle's DBMS_SCHEDULER (Oracle 11g) and need help setting up the following:

I have a procedure that calls a list of other procedures like this:

CREATE OR REPLACE
PROCEDURE RUN_JOBS AS
BEGIN
  MYUSER.MYPROCEDURE1();
  MYUSER.MYPROCEDURE2();
  MYUSER.MYPROCEDURE3();
  MYUSER.MYPROCEDURE4();
  MYUSER.MYPROCEDURE5();
END;
/

I would like to use DBMS_SCHEDULER to run MYPROCEDURE3(), MYPROCEDURE4(), MYPROCEDURE5() in parallel after the completion of MYPROCEDURE2().

Can someone show me an example on how to set this up?

3条回答
冷血范
2楼-- · 2019-06-08 09:03

You can refer to Chains under the DBMS_SCHEDULER package: http://docs.oracle.com/cd/B28359_01/server.111/b28310/scheduse009.htm

You can also achieve the same by going through Oracle Enterprise Manager, but I can't find any links to documentation right now.

查看更多
Summer. ? 凉城
3楼-- · 2019-06-08 09:03

You can do that using DBMS_SCHEDULER.

CREATE OR REPLACE PROCEDURE RUN_JOBS
AS
v_JobNum NUMBER := 1;
BEGIN
 BEGIN
  DBMS_JOB.SUBMIT(v_JobNum,'MYUSER.MYPROCEDURE1;',sysdate,'sysdate +1');
  DBMS_JOB.SUBMIT(v_JobNum,'MYUSER.MYPROCEDURE2;',sysdate,'sysdate +1');
  DBMS_JOB.SUBMIT(v_JobNum,'MYUSER.MYPROCEDURE3;',sysdate,'sysdate +1');
  DBMS_JOB.SUBMIT(v_JobNum,'MYUSER.MYPROCEDURE4;',sysdate,'sysdate +1');
  COMMIT;
 END;
END RUN_JOBS; 
/

This will submit the job and run them immediately.

查看更多
做自己的国王
4楼-- · 2019-06-08 09:26

create three different jobs for each procedure and schedule them at same time.

查看更多
登录 后发表回答