Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: job starts at 'dbstart' ?

Re: job starts at 'dbstart' ?

From: Andy Hardy <aph_at_ahardy.demon.co.uk>
Date: Mon, 16 Aug 1999 10:49:42 +0100
Message-ID: <UVJtvDA269t3Ewfm@ahardy.demon.co.uk>


In article <nmyt3.23$qI1.155683_at_nnrp3.proxad.net>, Vincent GRENET <vincent.grenet_at_free.fr> writes
>Hello all.
>
>I have a job scheduled to run at a certain time. When Oracle is not running
>at that time, the job is run when the server is restarted (dbstart).
>
>This a problem since the job can last up to one or two hours. I have seen
>nothing about that feature(?) in the documentation.

I *like* jobs to run as soon as possible after the specified time!

>
>How can I avoid that ?

If you only want it to run at certain times, look at modifying the 'next' value of the job itself. The following example tries to run between 3am and 5am:

procedure refresh_db_size (p_next_date IN OUT DATE) as begin

        IF sysdate between to_date(to_char(sysdate, 'DD-MON-YY') || ' 03:00', 'DD-MON-YY HH24:MI') AND to_date(to_char(sysdate, 'DD-MON-YY') || ' 05:00', 'DD-MON-YY HH24:MI') THEN

                get_db_size.tables_size;
                get_db_size.indexes_size;
        ELSIF sysdate < to_date(to_char(sysdate, 'DD-MON-YY') || '
03:00', 'DD-MON-YY HH24:MI') THEN
                        --
                        -- a little bit early for todays job
                        --
                        p_next_date := to_date(to_char(sysdate, 'DD-MON-
YY') || ' 03:05', 'DD-MON-YY HH24:MI');         
        ELSE
                        --
                        -- too late for today, try again tomorrow
                        --
                        p_next_date := to_date(to_char(sysdate + 1, 'DD-
MON-YY') || ' 03:05', 'DD-MON-YY HH24:MI');
        END IF;

end;

You just need to include the 'NEXT_DATE' as a parameter for the job during the jobs submission e.g. the 'WHAT' for the above would be 'refresh_db_size(NEXT_DATE);'.

Andy
--
Andy Hardy. PGP key available on request


Received on Mon Aug 16 1999 - 04:49:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US