Oracle误删表或者数据后,采用闪回恢复的SQL脚本

 select 'flashback table "'||object_name||'" to before drop;' from recyclebin where ts_name='TS_JEECG' and droptime like '2017-01-12%' ;


select 'flashback table "'||original_name||'" to before drop;' from recyclebin where type='INDEX' and ts_name='TS_JEECG' and droptime like '2017-01-12%'  order by droptime desc ;

select 'alter table '||original_name||' enable row movement;' from recyclebin where type='TABLE' and ts_name='TS_JEECG' and droptime like '2017-01-12%'  order by droptime desc ;


select object_name,original_name,partition_name,type,ts_name,createtime,droptime from recyclebin  where type='INDEX' and ts_name='TS_JEECG' and droptime like '2017-01-12%'  order by droptime desc ;

flashback table A to timestamp(systimestamp-interval '10' minute);



alter table bs_checkin enable row movement;

select 'alter index  "'||index_name||'" rebuild;',i.index_name from user_indexes i ;

select 'flashback table "'||original_name||'" to before drop;'

alter index index_name rebuild

标签: droptime, select, table, ts_name, flashback

添加新评论