创建每天运行的oracle Scheduler作业 [英] Create oracle scheduler job which runs daily

查看:158
本文介绍了创建每天运行的oracle Scheduler作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建每天在20:00运行并运行30分钟的oracle Scheduler作业.该作业将删除KPI_LOGS表中的行,因为该表包含大量数据,并且将继续增长.我已经在oracle sql developer中为以下工作创建了以下脚本,但是不确定这是否正确,因为我是Scheduler的工作概念的新手.

I want to create oracle scheduler job which runs daily at 20:00 and runs for 30 minute. This job will delete the rows from KPI_LOGS table as this table contains large amount of data and it continues to grow. I have created the below script in oracle sql developer for such job but not sure if this is correct or not as i am new to scheduler job concept.

    BEGIN
        DBMS_SCHEDULER.CREATE_JOB (
                job_name => '"RATOR_MONITORING"."CROP_KPI_LOGS"',
                job_type => 'PLSQL_BLOCK',
                job_action => 'DELETE FROM KPI_LOGS WHERE CAST(TIMESTAMP AS DATE) < (SYSDATE  - 28);',
                number_of_arguments => 0,
                start_date => NULL,
                repeat_interval => 'FREQ=DAILY;INTERVAL=30',
                end_date => NULL,
                enabled => FALSE,
                auto_drop => FALSE,
                comments => 'CROP_KPI_LOGS');    

        DBMS_SCHEDULER.SET_ATTRIBUTE( 
                 name => '"RATOR_MONITORING"."CROP_KPI_LOGS"', 
                 attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);



    DBMS_SCHEDULER.enable(
             name => '"RATOR_MONITORING"."CROP_KPI_LOGS"');
END;

推荐答案

repeat_internal不正确,您那里拥有的内容将每30天运行一次.每天晚上8点跑步去...

the repeat_internal is incorrect, what you have there will run every 30 days. to run at 8pm each day go for...

FREQ=DAILY; BYHOUR=20

您无法确定它将运行多长时间,这将花费您的DELETE语句所需的时间

you can't dictate how long it will run for, it will take as long as your DELETE statement takes

这篇关于创建每天运行的oracle Scheduler作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆