Welcome 微信登录

首页 / 数据库 / MySQL / Oracle快速创建定时job执行批量转储过程脚本参考案例

-- 创建短信批量转储存储过程,将已经发送的短信转移至短信历史表create or replace procedure PUB_SHORTMSG_ARCH_BAT
    as
        MSG_ID pub_shortmsg_td.shotmsg_id%type;
        cursor cur_msg is
             select shotmsg_id from pub_shortmsg_td a where a.send_flag!=0;
        cur_rec cur_msg%rowtype;
    begin
        open cur_msg;
            loop
                fetch cur_msg into cur_rec;
                exit when cur_msg%notfound;
                MSG_ID := cur_rec.shotmsg_id;
                insert into his_pub_shortmsg_td (select * from pub_shortmsg_td where shotmsg_id=MSG_ID);
                delete pub_shortmsg_td where shotmsg_id=MSG_ID;
                COMMIT;
            end loop;
        close cur_msg;
end PUB_SHORTMSG_ARCH_BAT;-- 建立job,每天凌晨1:30执行已发送短信的历史转储
VARIABLE job NUMBER;
begin
sys.dbms_job.submit(job => :job,
                      what => "PUB_SHORTMSG_ARCH_BAT();",
                      next_date => to_date("30-08-2008 01:30:05", "dd-mm-yyyy hh24:mi:ss"),
                      interval => "sysdate+1");
commit;
end;
/杀掉(kill)Oracle中会话或死锁Oracle快速创建DBlink的脚本相关资讯      Oracle教程 
  • Oracle中纯数字的varchar2类型和  (07/29/2015 07:20:43)
  • Oracle教程:Oracle中查看DBLink密  (07/29/2015 07:16:55)
  • [Oracle] SQL*Loader 详细使用教程  (08/11/2013 21:30:36)
  • Oracle教程:Oracle中kill死锁进程  (07/29/2015 07:18:28)
  • Oracle教程:ORA-25153 临时表空间  (07/29/2015 07:13:37)
  • Oracle教程之管理安全和资源  (04/08/2013 11:39:32)
本文评论 查看全部评论 (0)
表情: 姓名: 字数