问题描述
嗨,
尽管他们已将最大作业持续时间设置为240分钟/4小时,但Oracle Scheduler作业继续运行超过15小时,直到他们将其杀死。我们如何使这项工作在最大工作持续时间之后停止一次?
我已经通过OEM上的Oracle调度程序进行了设置。它显示在dba_scheduler_jobs中,但不会停止作业。因此,为什么它不能停止工作。
开始
dbms_scheduler.create_job('"GATHERSTATS_OSMCORE_SCHEMA"',
job_type =>'可执行',job_action =>
'c:\ windows \ system32 \ cmd.exe'
,参数编号 =>2,
开始日期 => 到 _ 时间戳 _ tz ('2017年6月20日美国/纽约上午12.00.00.000000000
,'dd-MON-RRRR HH.MI.SSXFF AM TZR','nls_date_language = english '),repeat_interval =
>
'FREQ = 每周; BYDAY = SUN;BYHOUR = 12;BYMINUTE = 0;BYSECOND = 0'
,end_date =>NULL,
job_class =>'"DEFAULT_JOB_CLASS"',enabled =>FALSE,auto_drop =>FALSE,comments =>
'Gatherstats_ossmcere_schema'
);
dbms_scheduler.set_attribute('"GATHERSTATS_OSMCORE_SCHEMA"','最大运行持续时间','
000 04:00:00);
dbms_scheduler.set_attribute('"GATHERSTATS_OSMCORE_SCHEMA"','raise_events',36);
提交;
结束;
谢谢,
尽管他们已将最大作业持续时间设置为240分钟/4小时,但Oracle Scheduler作业继续运行超过15小时,直到他们将其杀死。我们如何使这项工作在最大工作持续时间之后停止一次?
我已经通过OEM上的Oracle调度程序进行了设置。它显示在dba_scheduler_jobs中,但不会停止作业。因此,为什么它不能停止工作。
开始
dbms_scheduler.create_job('"GATHERSTATS_OSMCORE_SCHEMA"',
job_type =>'可执行',job_action =>
'c:\ windows \ system32 \ cmd.exe'
,参数编号 =>2,
开始日期 => 到 _ 时间戳 _ tz ('2017年6月20日美国/纽约上午12.00.00.000000000
,'dd-MON-RRRR HH.MI.SSXFF AM TZR','nls_date_language = english '),repeat_interval =
>
'FREQ = 每周; BYDAY = SUN;BYHOUR = 12;BYMINUTE = 0;BYSECOND = 0'
,end_date =>NULL,
job_class =>'"DEFAULT_JOB_CLASS"',enabled =>FALSE,auto_drop =>FALSE,comments =>
'Gatherstats_ossmcere_schema'
);
dbms_scheduler.set_attribute('"GATHERSTATS_OSMCORE_SCHEMA"','最大运行持续时间','
000 04:00:00);
dbms_scheduler.set_attribute('"GATHERSTATS_OSMCORE_SCHEMA"','raise_events',36);
提交;
结束;
谢谢,
专家解答
从文档中:
"max_run_duration
This attribute specifies the maximum amount of time that the job should be allowed to run. Its datatype is INTERVAL DAY TO SECOND. If this attribute is set to a non-zero and non-NULL value, and job duration exceeds this value, the Scheduler raises an event of type JOB_OVER_MAX_DUR. It is then up to your event handler to decide whether or not to allow the job to continue."
因此,我们正在做的就是监视作业,并在长时间运行时引发job_over_max_dur事件。你可以创建一个工作来响应这个事件,采取任何你想做的行动,例如
"max_run_duration
This attribute specifies the maximum amount of time that the job should be allowed to run. Its datatype is INTERVAL DAY TO SECOND. If this attribute is set to a non-zero and non-NULL value, and job duration exceeds this value, the Scheduler raises an event of type JOB_OVER_MAX_DUR. It is then up to your event handler to decide whether or not to allow the job to continue."
因此,我们正在做的就是监视作业,并在长时间运行时引发job_over_max_dur事件。你可以创建一个工作来响应这个事件,采取任何你想做的行动,例如
begin dbms_scheduler.add_event_queue_subscriber('myagent'); end; begin dbms_scheduler.create_job( 'killer', job_action=>'...appropriate killing behaviour...', event_condition => 'tab.user_data.object_name = ''GATHERSTATS_OSMCORE_SCHEMA'' and tab.user_data.event_type = ''JOB_OVER_MAX_DUR''', queue_spec =>'sys.scheduler$_event_queue,myagent', enabled=>true); end;复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
601次阅读
2025-04-15 17:24:06
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
587次阅读
2025-04-18 14:18:38
XTTS跨版本迁移升级方案(11g to 19c RAC for Linux)
zwtian
494次阅读
2025-04-08 09:12:48
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
478次阅读
2025-04-20 10:07:02
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
463次阅读
2025-04-22 00:20:37
Oracle 19c RAC更换IP实战,运维必看!
szrsu
439次阅读
2025-04-08 23:57:08
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
437次阅读
2025-04-22 00:13:51
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
428次阅读
2025-04-17 17:02:24
火焰图--分析复杂SQL执行计划的利器
听见风的声音
371次阅读
2025-04-17 09:30:30
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
360次阅读
2025-04-15 14:48:05