创建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;
当回收站记录达到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博客 ” ,链接:http://blog.itpub.net/29065182/viewspace-1750378/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29065182/viewspace-1750378/