如何创建“单例”实例 oracle中的预定工作?

发布于 2024-07-25 09:14:36 字数 137 浏览 4 评论 0 原文

这可能只是我缺少找出如何执行此操作的词汇:

计划每 5 分钟定期运行一次的作业,但是要跟踪它永远不会有两个实例同时运行,即下一个实例将被推迟如果之前的运行时间超过 5 分钟,则跳过。

实现这一目标最简单/最优雅的方法是什么?

It's probably just the vocabulary I am missing to find out how to do this:

A job scheduled to run regularly every 5 mins, however keeping track that there are never two instances of it running at the same time, i.e. the next instance would be postponed or skipped if the prior runs longs than 5 mins.

What is the easiest/most elegant way to achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

埋情葬爱 2024-08-01 09:14:37

DBMS_JOB 负责处理这个问题。 只需使用它即可。

DBMS_JOB takes care of that. Just use it.

很快妥协 2024-08-01 09:14:37

dbms_scheduler 比 dbms_job 的另一个优点是您可以更好地控制负载、资源使用情况,并且还可以运行数据库外部的作业。

哈,
罗纳德.

an other advantage that dbms_scheduler has above dbms_job is that you can better control the load, resource usage and that you can also run jobs external to the database.

hth,
Ronald.

荒人说梦 2024-08-01 09:14:37

如果由于某种原因 dbms_job 或 dbms_scheduler 不适合您,您还可以使用 DBMS_APPLICATION_INFO.SET_APPLICATION_INFO 来设置作业的模块名称,并且您可以查询 v$session 以查看当前有多少个会话执行该模块。

这是什么类型的工作? PL/SQL 存储过程?

If for some reason dbms_job or dbms_scheduler doesn't work for you, you could also use DBMS_APPLICATION_INFO.SET_APPLICATION_INFO to set the module name of your job and you could query v$session to see how many sessions are currently executing that module.

What type of job is this? A PL/SQL stored procedure?

羁绊已千年 2024-08-01 09:14:36

来自 Oracle 10g 管理员指南:

“DBMS_JOB 包已被 DBMS_SCHEDULER 包 特别是,如果您正在管理作业来管理系统负载,则应考虑通过撤销用户的包执行权限来禁用 DBMS_JOB。

DBMS_SCHEDULER 是 Oracle 目前推荐的执行此操作的方法。 它的一个优点是,如果您使用它,您可以通过企业管理器/网格控制来管理您的作业。

From the Oracle 10g administrators guide:

"The DBMS_JOB package has been superseded by the DBMS_SCHEDULER package. In particular, if you are administering jobs to manage system load, you should consider disabling DBMS_JOB by revoking the package execution privilege for users."

DBMS_SCHEDULER is Oracle's recommended way to do this now. One advantage it has is that you can manage your jobs via Enterprise Manager/Grid Control if you're using this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文