oracle恢复误删表或数据

确认是否开启闪回

select log_mode,flashback_on from v$database;

若误删表,可通过回收站找回

切换至对应的用户:

SQL> SHOW RECYCLEBIN;

  ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
  ---------------- ------------------------------ ------------ -------------------
  T_STU    BIN$tXWUq4GzCVjgUPQKJ6hdGA==$0 TABLE    2020-12-02:13:33:19

还原表

FLASHBACK TABLE T_STU TO BEFORE DROP;

还原成新的表名

FLASHBACK TABLE T_STU TO BEFORE DROP RENAME TO T_STU_TMP;

表中的数据不小心删除或变更了,利用回滚恢复数据

1.开启行移动模式

alter table table_name enable row movement;

2.使用flashBack:[这种方法用的比较多,不小心删除了,马上就可以闪回][闪回到5分钟以前]

flashback table table_name to TIMESTAMP systimestamp - interval '5' minute;

3.查询恢复结果

select * from table_name;
select * from DBA_RECYCLEBIN where OWNER='USERNAME';

删除回收站某表:

purge table "BIN$/UpBuh+LQ9yZGN95BFsk5Q==$0";

清空回收站:

purge recyclebin;

1.查看表历史时刻数据

select * from table_name AS OF TIMESTAMP to_timestamp('2020/12/02 13:20:00','yyyy/mm/dd hh24:mi:ss');

2、利用flashback table恢复表到过去某一时刻

alter table table_name enable row movement; 
flashback table table_name to timestamp to_timestamp('2020/12/02 13:20:00','yyyy/mm/dd hh24:mi:ss'); 
alter table table_name disable row movement;
posted @ 2020-12-02 13:43  玄澈  阅读(199)  评论(0编辑  收藏  举报