【Oracle SQL】Oracle误操作删表恢复

问题描述(一):

场景:用户误操作删除某张表,短时间内操作
操作信息:
误操作后未修改表结构
已知操作时间范围

解决方法

  1. 查询数据是否还存在SGA,与用户确认数据
select * from scott.emp as of timestamp to_timestamp('2021/12/30 13:30','yyyy/mm/dd hh24:mi'); 
  1. 确认无误后,将查询出的结果插入表
insert into scott.emp
select * from scott.emp as of timestamp to_timestamp('2021/12/30 13:30','yyyy/mm/dd hh24:mi'); 

问题描述(二):

场景:用户误操作删除某张表,短时间内操作
操作信息:
误操作后有/无修改表结构
已知操作时间范围

解决方法

  1. 查询数据是否还存在SGA,与用户确认数据
select * from scott.emp as of timestamp to_timestamp('2021/12/30 13:30','yyyy/mm/dd hh24:mi'); 
  1. 查出该时间点对应的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;
  1. 表闪回前必须启用数据行的移动特性
alter table scott.emp enable row movement;
  1. 闪回表
--方式一:
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');

问题描述(三):

场景:用户误操作删除某张表,发生时间过长,无法闪回找回
操作信息:
误操作后有/无修改表结构
已知操作时间范围

解决方法

  1. 日志挖掘
    参考文档:
    https://blog.csdn.net/Cherry599/article/details/139053254?spm=1001.2014.3001.5501
  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值