ORACLE—006:移除和停止JOB,oracle006移除job

來源:互聯網
上載者:User

ORACLE—006:移除和停止JOB,oracle006移除job

一般來說都是通過sql來刪除或者停止某個job。

移除JOB:remove

停止JOB:broken

首先通過

 select * from user_jobs;

尋找出JOB的ID,然後調用

dbms_job.broken或

dbms_job.remove進行移除和停止。sql如下。

以移除一個job為例。

1、通過JOB的what值來尋找job,並移除。

declare  job number;  v_count number;begin     SELECT COUNT(*)    INTO v_count    FROM user_jobs uj    WHERE upper(uj.what) =     UPPER('建立JOB時的what值');        if v_count > 0 then      SELECT uj.JOB      INTO job      FROM user_jobs uj      WHERE upper(uj.what) =       UPPER('建立JOB時的what值');    dbms_job.remove(job);    commit;  end if;end;


2、本來就知道JOB的id則直接調用即可。

JOB的id是user_jobs的JOB欄位的值。

 begin    dbms_job.broken.remove(JOB1的ID);    dbms_job.remove(JOB2的ID); end;

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.