On Wednesday, February 27, 2013 12:56:07 AM UTC-7, IYAD wrote:
>
> Nice Morning Professionals,
>
>
>
> I have schedulers jobs some are connected with each others
>
> So I created a table and inserted the procedures in it as follow
>
>
>
> ID Parent_ID Pro
>
> ---------------------------------------------------------------------
>
> 1 Null Procedure1
>
> 2 1 Procedure2
>
> 3 1 Procedure3
>
> 4 2 Procedure4
>
>
>
> What I need is to run the first one and when it’s done
>
> Then run is parallel sessions using scheduler jobs ID no 2 & 3
>
> And when 2 is done then run ID no 4
>
>
>
> The business is very big and the list is so long but it’s a sample,
>
> I need some ideas from you.
>
>
> Best Regards,
>
> Iyad
>
This is a textbook case for a scheduler chain:
--
-- Create the chain
--
BEGIN
DBMS_SCHEDULER.CREATE_CHAIN (
chain_name => 'my_proc_chain',
rule_set_name => NULL,
evaluation_interval => NULL,
comments => NULL);
END;
/
--
-- Define the four steps for this chain. Referenced programs must be
enabled.
--
BEGIN
DBMS_SCHEDULER.DEFINE_CHAIN_STEP('my_proc_chain', 'stepA', 'Procedure1');
DBMS_SCHEDULER.DEFINE_CHAIN_STEP('my_proc_chain', 'stepB', 'Procedure2');
DBMS_SCHEDULER.DEFINE_CHAIN_STEP('my_proc_chain', 'stepC', 'Procedure3');
DBMS_SCHEDULER.DEFINE_CHAIN_STEP('my_proc_chain', 'stepD', 'Procedure4');
END;
/
--
-- Define the rules for how the chain executes tasks
--
-- Notice that StepD starts after StepB completes and the chain doesn't end
-- until both StepC and StepD complete
--
BEGIN
DBMS_SCHEDULER.DEFINE_CHAIN_RULE('my_proc_chain', 'TRUE', 'START stepA');
DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
'my_proc_chain', 'stepA COMPLETED', 'Start stepB, stepC');
DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
'my_proc_chain', 'stepB COMPLETED', 'Start StepD');
DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
'my_proc_chain', 'stepC COMPLETED AND stepD COMPLETED', 'END');
END;
/
--
-- Enable the completed chain
--
BEGIN
DBMS_SCHEDULER.ENABLE('my_proc_chain');
END;
/
--
-- Create a job to start the chain daily at 1:00 p.m.
--
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'chain_job_1',
job_type => 'CHAIN',
job_action => 'my_proc_chain',
repeat_interval => 'freq=daily;byhour=13;byminute=0;bysecond=0',
enabled => TRUE);
END;
/
David Fitzjarrell
--
--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
---
You received this message because you are subscribed to the Google Groups
"Oracle PL/SQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.