• Stop_Disable_Drop_Scheduler_JOB



    SELECT * FROM DBA_SCHEDULER_JOBS t WHERE OWNER='TEST';
    SELECT * FROM DBA_SCHEDULER_PROGRAMS WHERE OWNER='TEST';
    --1.stop jobs and enable/disable jobs
    BEGIN

    FOR V IN(SELECT * FROM DBA_SCHEDULER_JOBS T WHERE OWNER='TEST' AND T.ENABLED='TRUE' AND STATE IN('RUNNING'))
    LOOP
    DBMS_SCHEDULER.STOP_JOB(V.JOB_NAME);
    DBMS_SCHEDULER.DISABLE(V.JOB_NAME);
    COMMIT;
    END LOOP;

    END;
    /
    --2.enable/disable jobs
    SELECT * FROM DBA_SCHEDULER_JOBS t WHERE OWNER='TEST' and t.enabled='TRUE';
    SELECT * FROM DBA_SCHEDULER_PROGRAMS WHERE OWNER='TEST';

    BEGIN

    FOR V IN(SELECT * FROM DBA_SCHEDULER_JOBS T WHERE OWNER='TEST' AND T.ENABLED='TRUE' AND STATE NOT IN('RUNNING'))
    LOOP
    DBMS_SCHEDULER.DISABLE(V.JOB_NAME);
    COMMIT;
    END LOOP;

    END;
    /


    --3.drop jobs and programs
    --clear data
    BEGIN

    --execute immediate 'TRUNCATE TABLE WF_NODE_TIMELINE';
    --execute immediate 'TRUNCATE TABLE WF_PROCESS';
    --execute immediate 'truncate table WF_NODE_QUEUE';

    FOR V IN (SELECT * FROM USER_SCHEDULER_JOBS WHERE JOB_NAME LIKE 'JOB_%') LOOP
    DBMS_SCHEDULER.DROP_JOB(V.JOB_NAME);
    END LOOP;

    FOR V IN (SELECT *
    FROM USER_SCHEDULER_PROGRAMS
    WHERE PROGRAM_NAME LIKE 'PRO_%') LOOP
    DBMS_SCHEDULER.DROP_PROGRAM(V.PROGRAM_NAME);
    END LOOP;
    END;
    /


    --4.SET ATTRIBUTE
    BEGIN
    DBMS_SCHEDULER.SET_ATTRIBUTE (
    name => 'JOB_ODS_IN_ACQ_APPL_PROD_MASTE',
    attribute => 'repeat_interval',
    value => 'freq=weekly; byday=wed');
    END;
    /


    ----------ONE RUN THEN DROP
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB
    (
    job_name =>'TEST',
    job_type =>'PLSQL_BLOCK',
    job_action =>'PROC_EXEC;',
    job_class =>'DEFAULT_JOB_CLASS',
    enabled =>TRUE,
    auto_drop =>TRUE,
    comments =>''
    );
    END;

    All for u
  • 相关阅读:
    性能测试概念
    接口测试概念
    SQL多表查询
    手机App测试概念
    App测试页面滑动
    自动化测试概念
    Monkey 命令
    Tomcat+JDK安装和配置
    Linux系统FTP安装、安装和使用
    Web测试方法(一)
  • 原文地址:https://www.cnblogs.com/ayumie/p/9558949.html
Copyright © 2020-2023  润新知