当前位置:网站首页> 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误删表数据恢复内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!
边栏推荐
- grep文本搜索工具
- C language - function knowledge points
- 怎么理解云原生数据库的易用性?
- redisTemplate
- Pyinstaller打包pikepdf失败的问题排查
- 2788.Cifera
- internship:术语了解及着手写接口
- Day88. qiniu cloud: upload house source pictures and user avatars
- Digital collection, ten thousand words long text, most of the questions you want to know have been clearly explained, which must be seen by practitioners
- 压缩与解压缩命令
猜你喜欢

Racher add / delete node

Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature

C # connect to the database to complete the operation of adding, deleting, modifying and querying

rsync远程同步

《数据安全法》出台一周年,看哪四大变化来袭?

Shell reads the value of the JSON file

2022年P气瓶充装考试练习题及在线模拟考试

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

Markdown mermaid种草(1)_ mermaid简介

还在付费下论文吗?快来跟我一起白piao知网
随机推荐
为什么C语言用使用其他文件的结构体变量时,声明结构体别名还不行,必须使用本名?(使用别名时不能加struct)
Bluecmsv1.6 code audit
2022 welder (elementary) special operation certificate examination question bank and answers
Tcwind mode setting
2788.Cifera
CSDN salary increase technology selenium automated test stack summary
Can layoffs really save China's Internet?
C # connect to the database to complete the operation of adding, deleting, modifying and querying
Severity code description project file line suppress status error lnk2038 detected a mismatch of "runtimelibrary": the value "md\u dynamicrelease" does not match the value "mdd\u dynamicde"
管道 | 与重定向 >
Kaggle肠胃道图像分割比赛baseline
Database learning notes (sql04)
On the first anniversary of the data security law, which four major changes are coming?
[algorithm] I brushed two big factory interview questions and learned array again with tears in my eyes“
1002_20181019
还在付费下论文吗?快来跟我一起白piao知网
1. 整合 Servlet
csdn涨薪技术-Selenium自动化测试全栈总结
Markdown mermaid种草(1)_ mermaid简介
ArrayList of collection