DBMS_SCHEDULER 在顶点 oracle 中
DBMS_SCHEDULER in apex oracle
我写了一个API包。它有 GET_INFO 程序。我希望每 20 分钟在后台执行一次此过程。我明白我应该用 dbms_scheduler 做什么。但总的来说我不明白在哪里注册它们。我将感谢这个例子或你的帮助)
我写了这样一段代码,但不知道用在什么地方:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name = 'My_Job',
job_type = 'STORED_PROCEDURE',
job_action = 'INSERT INTO TEST2(UPDATEDAT)
VALUES (sysdate);
END;',
start_date = 'systimestamp',
repeat_interval = 'FREQ=SECONDLY;INTERVAL=5',
end_date = null,
auto_drop = FALSE,
comments = 'My new job');
END;
这是我的代码,但我不知道将它存储在哪里。
正如工作类型所暗示的那样,您需要创建一个程序,例如
create or replace procedure Ins_Test2 is
begin
insert into Test2(updatedat) values(sysdate);
commit;
end;
然后通过
创建调度器
begin
dbms_scheduler.create_job (
job_name => 'My_Job',
job_type => 'STORED_PROCEDURE',
job_action => 'Ins_Test2',
start_date => systimestamp,
repeat_interval => 'freq=minutely; interval = 20; byday=MON,TUE,WED,THU,FRI;',
enabled => true,
comments => 'My new job'
);
end;
我添加的地方
byday=MON,TUE,WED,THU,FRI;
as an extra direction if you want to run
the scheduler within the working days(you can omit that part if you'd
like).
systimestamp
(get rid of quotes) for start_date might be
replaced with an upcoming time info such as start_date => '13-FEB-20 2.00.00PM Asia/Istanbul'
就我而言。
然后通过
列出创建的调度程序
select job_name, next_run_date
from dba_scheduler_jobs j;
目前 运行 个来自
select *
from user_scheduler_job_log l
order by l.log_date desc;
并通过
删除调度程序
begin
dbms_scheduler.drop_job( job_name => 'My_Job' );
end;
我写了一个API包。它有 GET_INFO 程序。我希望每 20 分钟在后台执行一次此过程。我明白我应该用 dbms_scheduler 做什么。但总的来说我不明白在哪里注册它们。我将感谢这个例子或你的帮助)
我写了这样一段代码,但不知道用在什么地方:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name = 'My_Job',
job_type = 'STORED_PROCEDURE',
job_action = 'INSERT INTO TEST2(UPDATEDAT)
VALUES (sysdate);
END;',
start_date = 'systimestamp',
repeat_interval = 'FREQ=SECONDLY;INTERVAL=5',
end_date = null,
auto_drop = FALSE,
comments = 'My new job');
END;
这是我的代码,但我不知道将它存储在哪里。
正如工作类型所暗示的那样,您需要创建一个程序,例如
create or replace procedure Ins_Test2 is
begin
insert into Test2(updatedat) values(sysdate);
commit;
end;
然后通过
创建调度器begin
dbms_scheduler.create_job (
job_name => 'My_Job',
job_type => 'STORED_PROCEDURE',
job_action => 'Ins_Test2',
start_date => systimestamp,
repeat_interval => 'freq=minutely; interval = 20; byday=MON,TUE,WED,THU,FRI;',
enabled => true,
comments => 'My new job'
);
end;
我添加的地方
byday=MON,TUE,WED,THU,FRI;
as an extra direction if you want to run the scheduler within the working days(you can omit that part if you'd like).
systimestamp
(get rid of quotes) for start_date might be replaced with an upcoming time info such asstart_date => '13-FEB-20 2.00.00PM Asia/Istanbul'
就我而言。
然后通过
列出创建的调度程序select job_name, next_run_date
from dba_scheduler_jobs j;
目前 运行 个来自
select *
from user_scheduler_job_log l
order by l.log_date desc;
并通过
删除调度程序begin
dbms_scheduler.drop_job( job_name => 'My_Job' );
end;