问题描述(一):
场景:用户误操作删除某张表,短时间内操作
操作信息:
误操作后未修改表结构
已知操作时间范围
解决方法
- 查询数据是否还存在SGA,与用户确认数据
select * from scott.emp as of timestamp to_timestamp('2021/12/30 13:30','yyyy/mm/dd hh24:mi');
- 确认无误后,将查询出的结果插入表
insert into scott.emp
select * from scott.emp as of timestamp to_timestamp('2021/12/30 13:30','yyyy/mm/dd hh24:mi');
问题描述(二):
场景:用户误操作删除某张表,短时间内操作
操作信息:
误操作后有/无修改表结构
已知操作时间范围
解决方法
- 查询数据是否还存在SGA,与用户确认数据
select * from scott.emp as of timestamp to_timestamp('2021/12/30 13:30','yyyy/mm/dd hh24:mi');
- 查出该时间点对应的SCN
--方式一:
select timestamp_to_scn(to_date('2021/12/30 13:30:00','yyyy/mm/dd hh24:mi:ss')) from dual;
--方式二:
select scn,to_char(time_dp,'yyyy-mm-dd hh24:mi:ss') from sys.smon_scn_time;
- 表闪回前必须启用数据行的移动特性
alter table scott.emp enable row movement;
- 闪回表
--方式一:
flashback table scott.emp to scn 4903620;
--方式二:
flashback table scott.emp to timestamp to_timestamp('2021/12/30 13:30:00','yyyy/mm/dd hh24:mi:ss');
问题描述(三):
场景:用户误操作删除某张表,发生时间过长,无法闪回找回
操作信息:
误操作后有/无修改表结构
已知操作时间范围
解决方法