Re: chained jobs

From: ddf <oratune_at_msn.com>
Date: Mon, 8 Dec 2008 07:10:58 -0800 (PST)
Message-ID: <d518e770-7d58-4703-913f-0f6ab3fd0918@y18g2000yqn.googlegroups.com>


On Dec 8, 8:46 am, helter skelter <helterskel..._at_gmail.com> wrote:
> hi,
>
> How to set condition to evaluate 1min after start of step_1?
> I've got this:
>
> BEGIN
> DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
>     chain_name   =>   'my_chain',
>     condition    =>   'TRUE',
>     action       =>   'START my_step_1',
>     rule_name    =>   'my_rule_1',
>     comments     =>   'start the chain');
> DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
>     chain_name   =>   'my_chain',
>     condition    =>   ':my_step_1.duration >= INTERVAL ''1'' minute',
>     action       =>   'START my_step_2',
>     rule_name    =>   'my_rule_2',
>     comments     =>   'start my_step_step_2 after 2m');
>     DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
>     chain_name   =>   'my_chain',
>     condition    =>   'my_step_1 succeeded and my_step_2 succeeded',
>     action       =>   'START my_step_3',
>     rule_name    =>   'my_rule_3',
>     comments     =>   'start my_step_step_3 after succede 1 i 2');
>        DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
>     chain_name   =>   'my_chain',
>     condition    =>   'my_step_1 completed and my_step_2 completed and
> my_step_3 completed',
>     action       =>   'END',
>     rule_name    =>   'my_rule_4',
>     comments     =>   'end');
> END;
> /
>
> and this:
>
> BEGIN
> DBMS_SCHEDULER.CREATE_CHAIN (
>     chain_name          => 'my_chain',
>     rule_set_name       => NULL,
>     evaluation_interval => INTERVAL '1' minute,
>     comments            => 'My first chain');
> END;
> /
>
> It doesn't work. Step 2 doesn't start 1min after start of step 1, but
> when step 1 is sompleted. What's wrong? Thanks for any advice
>
> oracle 10gr2, linux

Probably because you're not using the chain rules you've configured:

"rule_set_name
 In the normal case, no rule set should be passed in. The Scheduler will automatically create a rule set and associated empty evaluation context. You then use DEFINE_CHAIN_RULE to add rules and DROP_CHAIN_RULE to remove them.

Advanced users can create a rule set that describes their chain dependencies and pass it in here. This allows greater flexibility in defining rules. For example, conditions can refer to external variables, and tables can be exposed through the evaluation context. If you pass in a rule set, you must ensure that it is in the format of a chain rule set. (For example, all steps must be listed as variables in the evaluation context). If no rule set is passed in, the rule set created will be of the form SCHED_RULESET${N} and the evaluation context created will be of the form SCHED_EVCTX${N}."

You've taken the time to create your chain rules but you haven't told dbms_scheduler to USE those chain rules. Try this, instead:

 BEGIN
 DBMS_SCHEDULER.CREATE_CHAIN (

     chain_name          => 'my_chain',
     rule_set_name       => 'my_rule_1',
     evaluation_interval => INTERVAL '1' minute,
     comments            => 'My first chain');
 END;
 /

and see if that fixes the 'problem'.

David Fitzjarrell Received on Mon Dec 08 2008 - 09:10:58 CST

Original text of this message