• dbms_job dbms_scheduler简单比较




    ---------------------------陈旧的-------------------------------------
    /*
    --------------------- 创建job ---------------------------  
    variable jobno number;
     
      begin
       dbms_job.submit(jobno,
       'book_yuqi011;',
       sysdate,
       'sysdate+1/24/60');
       commit;
    end;

    /

    ------------------ 检查job状态 --------------------
    DECLARE
      jobno02 number;
     
      BEGIN
    SELECT JOB INTO JOBNO02 FROM USER_JOBS;
    DBMS_OUTPUT.put_line(JOBNO02);
    DBMS_JOB.remove(JOBNO02);
    --SELECT JOB INTO JOBNO02 ,NEXT_DATE,NEXT_SEC,FAILURES,BROKEN FROM USER_JOBS;
    END;

    ------------------ 删除job --------------------
    BEGIN
      DBMS_JOB.remove(3);
      COMMIT;
      END;
    */


    ---------------------------最新的-------------------------------------

    --------------------- 创建job ---------------------------
    BEGIN
      SYS.DBMS_SCHEDULER.CREATE_JOB(JOB_NAME            => 'JOB_BOOK_YUQI011',           --指定job的名称
                                    JOB_TYPE            => 'STORED_PROCEDURE',           --指定job操作的类型
                                    JOB_ACTION          => 'BOOK_YUQI',                  --指定job的操作
                                    START_DATE          => TO_DATE('20-08-2015 17:13:20', 'DD-MM-YYYY HH24:MI:SS'),     --指定job开始运行的时间
                                    REPEAT_INTERVAL     => 'FREQ=MINUTELY;INTERVAL=1',                                  --指定job运行的频率 ,常见的 daily、minutely
                            --      END_DATE            => TO_DATE('21-08-2015 17:13:20', 'DD-MM-YYYY HH24:MI:SS'),     --指定job结束运行的时间
                                    JOB_CLASS           => 'DEFAULT_JOB_CLASS',                                         --指定job的级别
                                    ENABLED             => TRUE,                                                        --创建job后是否启用job
                                    AUTO_DROP           => FALSE,                                                       --job是否自动删除 (默认情况下 job运行成功后,会自动删除)
                                    COMMENTS            => 'MY NEW JOB');                                               --job的注释,可有可无
    END;


    --------------------- 运行job ---------------------------
    BEGIN
       SYS.DBMS_SCHEDULER.RUN_JOB(JOB_NAME=>'JOB_BOOK_YUQI022',USE_CURRENT_SESSION =>TRUE);
    END;


    --------------------- 检查job的运行状态 ---------------------------
    SELECT JOB01.job_namE,JOB01.JOB_ACTION,JOB01.start_date,JOB01.REPEAT_INTERVAL,JOB01.AUTO_DROP,JOB01.STATE,JOB01.run_count
    FROM USER_SCHEDULER_JOBS JOB01
    WHERE JOB_CREATOR='DEV';

    SELECT JOB_RUN.LOG_ID,JOB_RUN.LOG_DATE,JOB_RUN.OWNER,JOB_RUN.JOB_NAME,JOB_RUN.STATUS,JOB_RUN.CPU_USED
    FROM USER_SCHEDULER_JOB_RUN_DETAILS JOB_RUN
    WHERE  JOB_NAME='JOB_BOOK_YUQI011' ORDER BY LOG_DATE DESC;



    --------------------- 删除job---------------------------
    BEGIN
       SYS.DBMS_SCHEDULER.DROP_JOB(JOB_NAME=>'JOB_BOOK_YUQI');
    END;

















  • 相关阅读:
    pandas 长宽格式的转换——pivot、pivot_table和melt
    PowerBI开发 第21篇:关键因素(Key Influencer)
    pandas Series矢量化的字符串函数——Series.str
    前端面试
    WebService详细讲解
    redis哨兵模式和集群模式优缺点_redis集群哨兵模式
    HTTPS如何保证数据传输安全性
    oracle 序列简介
    dataguard基本简介及三大保护模式介绍
    一致性哈希算法原理详解
  • 原文地址:https://www.cnblogs.com/iyoume2008/p/4769908.html
Copyright © 2020-2023  润新知