两种方法:
一:根据时间恢复
select * from EMP;
delete from EMP where EMPNO=7369;
查询当前电脑时间:
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss')from dual;
查询删除之前数据:
select * from EMP as of timestamp to_timestamp('2018-04-12 09:12:11','yyyy-mm-dd hh24:mi:ss');
恢复数据:
flashback table EMP to timestamp to_timestamp('2018-04-12 09:12:11','yyyy-mm-dd hh24:mi:ss');
若出现报错:ORA-08189:未启用行移动功能,不能闪回表;
则:
alter table EMP enable row movement;
二:根据数据库SCN恢复数据
1、查询当前数据库SCN号
select current_scn from v$database;(不能执行的话,切换到sys用户或system用户查询)
查询到的当前值为:91799986
2、缩小SCN号查询被删除表数据(若无数据继续缩小SCN,由于数据库操作不止一人,SCN号变化比较多,可以多缩小几个号)
select * from 表名 as of scn 91799980;
3、恢复数据
flashback table 表名 to scn 91799980;
恢复完成。若报错:ORA-08189:未启用行移动功能,不能闪回表;结果方案同上。