Home » RDBMS Server » Server Administration » execute a job every x minutes
execute a job every x minutes [message #235954] Tue, 08 May 2007 08:58 Go to next message
aline
Messages: 92
Registered: February 2002
Member
hello,

I'm working with oracle 9.2.0.7
I want to execute a job every 10 minutes (exactly).
the interval defined in the dbms_job package start after the execution on the job. So, If I have a 'SYSDATE + 10/1440 interval' and my procedure take approximatively two minutes, My interval will be 12 minutes.

Off course, I can easily do that with unix crontab crontab....

Do you have an idea?
th for the help Smile
Re: execute a job every x minutes [message #235962 is a reply to message #235954] Tue, 08 May 2007 09:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68686
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select sysdate, 
  2         trunc(sysdate)+(trunc(to_number(to_char(sysdate,'SSSSS'))/600)+1)*600/86400
  3  from dual
  4  /
SYSDATE  TRUNC(SY
-------- --------
16:20:00 16:30:00

1 row selected.

SQL> /
SYSDATE  TRUNC(SY
-------- --------
16:20:04 16:30:00

1 row selected.

SQL> /
SYSDATE  TRUNC(SY
-------- --------
16:26:51 16:30:00

1 row selected.

SQL> /
SYSDATE  TRUNC(SY
-------- --------
16:29:27 16:30:00

1 row selected.

SQL> /
SYSDATE  TRUNC(SY
-------- --------
16:29:59 16:30:00

1 row selected.

SQL> /
SYSDATE  TRUNC(SY
-------- --------
16:30:00 16:40:00

1 row selected.

SQL> /
SYSDATE  TRUNC(SY
-------- --------
16:30:01 16:40:00

1 row selected.

Regards
Michel
Re: execute a job every x minutes [message #236007 is a reply to message #235954] Tue, 08 May 2007 12:07 Go to previous messageGo to next message
aline
Messages: 92
Registered: February 2002
Member
very nice!

and what happen if the procedure take more than 10 minutes?
Re: execute a job every x minutes [message #236010 is a reply to message #236007] Tue, 08 May 2007 12:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68686
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Why do you want to execute each 10 minutes a job that lasts more than 10 minutes?

If you are in such a case you have a flaw in the logic. Wink

Regards
Michel
Re: execute a job every x minutes [message #236015 is a reply to message #236010] Tue, 08 May 2007 12:48 Go to previous messageGo to next message
aline
Messages: 92
Registered: February 2002
Member
not in my case!

my job is a procedure who is executing N other independent procedures. So, I want to see 2 parallels executions of it if it take more than 10 minutes.
In UNIX world, this is not a problem and there is no 'hole' in my logic Razz !
Re: execute a job every x minutes [message #236016 is a reply to message #236015] Tue, 08 May 2007 12:52 Go to previous message
Michel Cadot
Messages: 68686
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So, in the end, it does not take more than 10 minutes to execute. Razz
(You can also slip your work in 2 parallel processes in Oracle too.)

Regards
Michel
Previous Topic: Data from a partition was somehow lost
Next Topic: difference
Goto Forum:
  


Current Time: Fri Sep 20 11:42:22 CDT 2024