Oracle中的定時任務

來源:互聯網
上載者:User

標籤:value   .com   nbsp   ken   技術分享   ora   啟動   jobs   com   

1、建立建立預存程序

1 create or replace procedure pro_test_job1 is2   begin3     insert into vacationsday(fldname,fldbegindata,fldenddata,fldselectid)values(‘清明節‘,to_date(‘2018-07-05‘,‘yyyy-mm-dd‘),to_date(‘2018-09-01‘,‘yyyy-mm-dd‘),1);4   end pro_test_job1;

2、定時任務建立

1 --定時任務  2 variable jobno number;3 begin4  dbms_job.submit(:jobno,‘pro_test_job1;‘, sysdate, ‘sysdate+1/24/60‘);5  commit;6 end;7 /

 

3、跟蹤定時任務

1 select job, next_date, next_sec, failures, broken from user_jobs;

結果:這裡的911即任務號[在刪除定時任務中需要用到]

4、顯示定時任務執行結果(預存程序中的資料操作)

 5、停止一個已經啟動的定時任務

1 begin2  dbms_job.broken(911, true, sysdate);3  commit;4 end;5 /

6、查看定時任務是否已經停止

1  select job, next_date, next_sec, failures, broken from user_jobs; 

結果:broken為Y表示定時任務已經停止

 

Oracle中的定時任務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.