当前位置:网站首页> oracle delete误删除表数据后如何恢复
oracle delete误删除表数据后如何恢复
2022-06-28 19:54:00 【1024问】
1、根据时间进行恢复
此种方式需要我们大致知道执行delete语句的时间。
查询系统当前时间:select to_char(sysdate,‘yyyy-mm-dd hh24:mi:ss’) from dual;
假设在2022-04-02 16:27:11分钟,执行了删除语句delete from demo ;

此时已经表中不能查询到数据了。我们知道delete执行的时间,往前推1分钟(delete执行时间之前都可以,越小越好,本例以1分钟为例),执行如下语句
select * from DEMO as of timestamp to_timestamp(‘2022-04-02 16:26:11',‘yyyy-mm-dd hh24:mi:ss');
可以看到虽然当前demo表中没有数据,但是可以查询到demo表前1分钟时候的数据。
恢复1:此时可以通过plsql工具的导出查询结果功能导出sql文件,然后在重新执行sql文件中的insert语句进行数据恢复。
恢复2:执行以下sql进行数据恢复:
flashback table DEMO to timestamp to_timestamp(‘2022-04-02 16:26:11',‘yyyy-mm-dd hh24:mi:ss');如果报错ORA-08189:未启用行移动功能,不能闪回表
则执行:
alter table DEMO enable row movement;添加表行移动功能后,在进行flashback语句进行恢复
如果报错: ORA-08194: 在实体化视图上不允许闪回表操作;则通过下面介绍的新建临时表的方式进行恢复。
恢复3(新建临时表):
新建demo1表,插入需要恢复的数据
create table DEMO1 as select * from DEMO as of timestamp to_timestamp(‘2022-04-02 16:30:11',‘yyyy-mm-dd hh24:mi:ss');将demo1表的数据恢复到demo表中
insert into DEMO select * from DEMO1 where not exists (select * from DEMO where DEMO.id=DEMO1.id);恢复4(根据scn恢复):
查询当前的scn号
select current_scn from v$database;
将scn号减少若干,执行下语句,直到能查看到我们delete的数据为止
select * from DEMO as of scn 166937913;通过合适的scn号,执行下sql语句进行数据恢复
flashback table DEMO to scn 166937913;总结
到此这篇关于oracle delete误删除表数据后如何恢复的文章就介绍到这了,更多相关oracle delete误删表数据恢复内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!
边栏推荐
- 怎么理解云原生数据库的快速迭代?
- 【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
- Kettle (VI): full database backup based on kettle
- R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
- 2022 tea master (intermediate) examination simulated 100 questions and simulated examination
- Grep text search tool
- 28 rounds of interviews with 10 companies in two and a half years
- Can layoffs really save China's Internet?
- 100人成绩的平均
- Leetcode week 299
猜你喜欢

【324. 摆动排序 II】

如何获取飞机穿过雷达两端的坐标

5G NR MBS架构介绍

How does win11 slim down the system disk? Slimming method of win11 system disk

数论 --- 欧拉函数、筛法求欧拉函数、欧拉定理、费马小定理详细证明

2022 welder (elementary) special operation certificate examination question bank and answers

5g NR MBS architecture introduction

2022焊工(初级)特种作业证考试题库及答案

Lecture 30 linear algebra Lecture 4 linear equations

2022 t elevator repair test question bank simulation test platform operation
随机推荐
QSP read label configuration error
[algorithm] I brushed two big factory interview questions and learned array again with tears in my eyes“
The first meta universe concept novel, meta universe 2086, won the upper attack meta universe award in 2022
Huawei cloud onemeeting tells you that the whole scene meeting is held like this!
Autumn recruitment experience sharing | how to prepare for bank interview
Paper notes: universal value function approvers
Pyinstaller打包pikepdf失败的问题排查
Machine learning notes temperature+softmax
Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature
28 rounds of interviews with 10 companies in two and a half years
522. 最长特殊序列 II(贪心&双指针)
各种类型长
1002_ twenty million one hundred and eighty-one thousand and nineteen
03.hello_rust
2022焊工(初级)特种作业证考试题库及答案
Rsync remote synchronization
Fix the simulator that cannot be selected by flutter once
[324. swing sequence II]
Design of secsha system
H5 sunflower operation