Oracle Scheduler: Calendaring

Oracle Scheduler: Calendaring Syntax

|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| freq=daily | Run once per day |
| freq=daily;bymonthday=2 | Run once on each 2nd day of a month |
| freq=daily;bymonthday=-1 | Run on the last day of a month |
| freq=daily;byday=tue | Run on Tuesdays. For a strange reason, the given value freq= is irrelevant: freq=monthly;byday=tue or freq=minutely;byday=tue etc. produce the same calendar! |
| freq=daily;byday=tue; byhour=12; byminute=0; bysecond=0 | Run on tuesdays almost exactly at noon (the fraction of a second cannot be specified). |
| freq=monthly;byday=2tue | Run on each month's second tuesday |
| freq=minutely;interval=5 | Run every fifth minute. |
| freq=hourly;byminute=7,31,42 | Runs three times per hour: on each hour's 7th, 31st and 42nd minute. |
| freq=minutely;byhour=7,8,16,17 | Runs every minute, but only between 7:00 and 9:00, and between 16:00 and 18:00. |
| freq=monthly;byday=mon,tue,wed,thu,fri;bysetpos=1 | Runs on each month's first business day. |
| freq=monthly;byday=mon,tue,wed,thu,fri;bysetpos=-1 | Runs on each month's last business day. |
| freq=daily;byday=mon,tue,wed,thu,fri;exclude=holidays | Run daily, Monday through Friday, but exclude days referenced in the schedule named holidays. |

Testing calendar strings

The following procedure can be used to test a calendar string

复制代码
create or replace procedure tq84_test_calendaring_syntax (
   calendar_string varchar2,
   start_date      timestamp with time zone := systimestamp,
   n               integer                  := 10
)
   authid definer
as
   next_run_date   timestamp with time zone := start_date;
begin

   for i in 1 .. n loop

      dbms_scheduler.evaluate_calendar_string(
         calendar_string   => calendar_string,
         start_date        => start_date,
         return_date_after => next_run_date,
         next_run_date     => next_run_date
     );

     dbms_output.put_line(next_run_date);

   end loop; 
end tq84_test_calendaring_syntax;
/

Time zone

The value of the scheduler's default time zone is important when using the calendaring syntax. This value can be queried like so:

复制代码
select
   value
from
   dba_scheduler_global_attribute
where
   attribute_name = 'DEFALT_TIMEZONE'
;

The value can be set with dbms_scheduler.set_scheduler_attribute.

相关推荐
山茶花.3 小时前
SQL注入总结
数据库·sql·oracle
沉舟侧畔千帆过_4 小时前
一个DBA的真心话:搞定Oracle+PG双库,我就靠这招
数据库·oracle·dba
奈斯ing4 小时前
【Oracle篇】基于OGG 21c全程图形化实现9TB数据从Oracle 11g到19c的不停机迁移(上):微服务架构详解与微服务部署,及同步问题总览(第一篇,总共三篇)
微服务·oracle·架构
醉风塘4 小时前
【终极解决方案】Oracle ORA-01795错误:IN列表1000条限制的全面突破指南
数据库·oracle
信创天地4 小时前
从 Oracle 到国产数据库:迁移后成本直降 60%、性能反超 30% 的实战秘籍
数据库·oracle
沉舟侧畔千帆过_4 小时前
能源核心系统国产化攻坚:智能电网调度系统从 Oracle 到金仓 KES 迁移实录
数据库·oracle·能源·kingbase·金仓数据库
chengrise4 小时前
Oracle EBS 成本异常排查全指南:差异分摊、成本回滚场景与解决方案
运维·数据库·oracle·erp·ebs
wxc0904 小时前
Oracle 性能分析系列:tkprof 工具详解 —— 解码 10046 Trace 的利器
数据库·oracle
洁辉4 小时前
Oracle 数据库中将某个字段的值根据逗号(,)分隔符拆分成多行显示
数据库·oracle
qife1224 小时前
CVE-2026-21962漏洞利用工具:Oracle WebLogic代理插件未授权RCE检测与利用
数据库·网络安全·oracle·渗透测试·weblogic·cve-2026-21962