ITPub博客

首页 > 数据库 > Oracle > oracle定期清空回收过程

oracle定期清空回收过程

原创 Oracle 作者:muxinqing 时间:2015-07-25 11:55:47 0 删除 编辑
创建job调度过程实现自动化

当回收站记录达到200记录,就开始清空回收站
create or replace procedure clear_recyclebin is

recy_count number(9);
time_drop  varchar2(2000);
sql_1        varchar2(1000);
cursor c_drop_time is select original_name from user_recyclebin where droptime < to_char((sysdate - interval '10' day),'yyyy-mm-dd hh24:mi:ss');

begin
   select count(1) into recy_count from user_recyclebin;
   if recy_count >= 200 then
     for time_drop in c_drop_time
       loop

   

    execute immediate 'purge table||time_drop.original_name||';
    dbms_output.put_line(time_drop.original_name);
      end loop;
   end if;
end    clear_recyclebin;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29065182/viewspace-1750378/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-01-14

  • 博文量
    143
  • 访问量
    1248163