Home » SQL & PL/SQL » SQL & PL/SQL » Scheduling job at 6 am and 7.30 pm (Oracle 10g)
Scheduling job at 6 am and 7.30 pm [message #648137] Wed, 17 February 2016 08:16 Go to next message
sss111ind
Messages: 634
Registered: April 2012
Location: India
Senior Member


Hi All,

How can we schedule a job to run at 6 am and 7.30 pm . Please suggest.

BEGIN
  dbms_scheduler.create_job (
    job_name        => 'TEST_job',
    job_type        => 'STORED_PROCEDURE',
    job_action      => 'TEST_EMP',
    start_date      => systimestamp,
    repeat_interval => 'FREQ=DAILY; BYHOUR=18; BYMINUTE=00; BYSECOND=00;',
    end_date        => NULL,
    enabled         => true,
    comments        => 'Job defined ');
end;


Regards,
Nathan

[Updated on: Wed, 17 February 2016 08:19]

Report message to a moderator

Re: Scheduling job at 6 am and 7.30 pm [message #648138 is a reply to message #648137] Wed, 17 February 2016 08:26 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
scheduler same task twice; once at 0600 & once at 1930 each to run daily.
Re: Scheduling job at 6 am and 7.30 pm [message #648139 is a reply to message #648138] Wed, 17 February 2016 08:35 Go to previous messageGo to next message
sss111ind
Messages: 634
Registered: April 2012
Location: India
Senior Member

Thank You BlackSwan ,

You mean to say, define two scheduler with 6 am and 7.30 pm to run the task. Is any way to do it in single scheduler.

Regards,
Nathan
Re: Scheduling job at 6 am and 7.30 pm [message #648140 is a reply to message #648139] Wed, 17 February 2016 08:43 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Is any way to do it in single scheduler.
you are free to do it any way that meets your requirements.
Nobody here prevents you from doing as you desire.
What is advantage of single scheduler?
Re: Scheduling job at 6 am and 7.30 pm [message #648169 is a reply to message #648138] Wed, 17 February 2016 21:02 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3273
Registered: January 2010
Location: Connecticut, USA
Senior Member
BlackSwan wrote on Wed, 17 February 2016 09:26
scheduler same task twice; once at 0600 & once at 1930 each to run daily.


Bad suggestion. You have to maintain 2 sets of code. Proper way is creating single job with combined schedule.

SY.
Re: Scheduling job at 6 am and 7.30 pm [message #648172 is a reply to message #648169] Wed, 17 February 2016 22:07 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9090
Registered: November 2002
Location: California, USA
Senior Member
BEGIN
  dbms_scheduler.create_schedule (
    schedule_name   => 'SCHED1', 
    repeat_interval => 'FREQ=DAILY; BYHOUR=6; BYMINUTE=00; BYSECOND=00;');
  dbms_scheduler.create_schedule (
    schedule_name   => 'SCHED2', 
    repeat_interval => 'FREQ=DAILY; BYHOUR=19; BYMINUTE=30; BYSECOND=00;'); 
  dbms_scheduler.create_job (
    job_name        => 'TEST_job',
    job_type        => 'STORED_PROCEDURE',
    job_action      => 'TEST_EMP',
    start_date      => systimestamp,
    repeat_interval => 'SCHED1,SCHED2',
    end_date        => NULL,
    enabled         => true,
    comments        => 'Job defined ');
END;
/

Re: Scheduling job at 6 am and 7.30 pm [message #648182 is a reply to message #648169] Thu, 18 February 2016 02:59 Go to previous messageGo to next message
gazzag
Messages: 1118
Registered: November 2010
Location: Bedwas, UK
Senior Member
Quote:

You have to maintain 2 sets of code.

Not if both jobs run the same code, surely?
Re: Scheduling job at 6 am and 7.30 pm [message #648193 is a reply to message #648182] Thu, 18 February 2016 06:09 Go to previous message
sss111ind
Messages: 634
Registered: April 2012
Location: India
Senior Member


Thank you All.
Thank you Barbara for providing great solution.

Regards,
Nathan

[Updated on: Thu, 18 February 2016 06:14]

Report message to a moderator

Previous Topic: Minus query with string values (merged)
Next Topic: update using with statement
Goto Forum:
  


Current Time: Thu Apr 25 02:11:35 CDT 2024