首先通过sql 把删除分区的语句拼接出来,select ‘alter table ‘||t.owner||’.’||t.object_name||’ drop partition(’||t.subobject_name||’);’ from dba_object t where t.owmer = ‘RPT’ and t.object_type = ‘TABLE_PARTITION’ and t.object_name in (‘LOT_STEP_HISTORY’)
and t.generated = ‘Y’ and t.created < sysdate - 40;
然后通过procedure 或shell脚本或者kettle类似的任务调度工具循环执行 拼好的语句即可。
简单高效!