oracle中恢复 drop表或delete数据

2014-11-24 08:06:45 · 作者: · 浏览: 3

create table xcp as (select * from b_za_bzdzkxx);

select * from xcp;

select count(1) from xcp;--22001

select count(1) from xcp t where t.dzbh like '510521%';--7011

delete from xcp t where t.dzbh like '510521%';

select count(1) from xcp;--14990

--查找指定时间点前的数据

select count(1) from xcp as of timestamp to_timestamp('2011-12-23 10:49:30','yyyy-MM-dd hh24:mi:ss');--22001

select * from xcp for update;--添加一条记录

select count(1) from xcp;--14991 www.2cto.com

--恢复指定时间点的前delete数据(将删除恢复时间点后面的数据)

alter table xcp enable row movement;--启动的行移动功能

flashback table xcp to timestamp to_timestamp('2011-12-23 10:49:30,'yyyy-MM-dd hh24:mi:ss');

select count(1) from xcp;--22001

--恢复指定时间点的前delete数据,并保留恢复时间点后面的数据

drop table xcp;

select count(1) from xcp;--0

--恢复drop的表

flashback table xcp to before drop;

select count(1) from xcp;--22001

摘自 xcp