create table log_lw(
user_name varchar2(10),
user_date date
);
create or replace procedure proc_lw
is
begin
insert into log_lw(user_name,user_date) values(user,sysdate);
commit;
end;
BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM(
program_name => 'prog_lw',
program_action => 'proc_lw',
program_type => 'STORED_PROCEDURE',
enabled => TRUE
);
END;
BEGIN
DBMS_SCHEDULER.CREATE_SCHEDULE(
schedule_name => 'schedule_lw',
start_date => SYSTIMESTAMP,
end_date => SYSTIMESTAMP + 1,
repeat_interval => 'FREQ=MINUTELY;INTERVAL=1',
comments => 'Every MINUTELY'
);
END;
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'lightweight_job',
program_name => 'prog_lw',
schedule_name => 'schedule_lw',
job_style => 'LIGHTWEIGHT'
);
END;
begin
dbms_scheduler.enable('lightweight_job');
end;
select job_name,job_style,to_char(start_date,'YYYY-MM-DD hh24:mi:ss') start_date
,repeat_interval,program_name,t.JOB_TYPE,
to_char(t.next_run_date,'yyyy-mm-dd hh24:mi:ss'),sysdate,to_char(t.last_start_date,'YYYY-MM-DD hh24:mi:ss')
from user_scheduler_jobs t
select * from log_lw