误删表数据处理方法
一,误删表数据
DELETE from 表名
where + 条件
示例:
DELETE from "EMP"
where DEPTNO = '20'
二,使用条件语句把误删数据查询出来
确定删除数据的时间(在删除数据之前的时间就行,不过最好是删除数据的时间点)
select * from 删除数据的表名 as of timestamp to_timestamp('删除数据之前的时间点', 'yyyy-mm-dd hh24:mi:ss') 找到你删除之前的数据,然后加上删除的条件
示例:
select * from "EMP" as of timestamp to_timestamp('2023-02-15 17:13:00','yyyy-mm-dd hh24:mi:ss') where DEPTNO = '20'
三,把误删数据插入原来表中
insert into 删除数据的表名 (select * from 删除数据的表名 as of timestamp to_timestamp('删除数据之前的时间点','yyyy-mm-dd hh24:mi:ss') 找到你删除之前的数据,然后加上删除的条件)
insert into "EMP" (select * from "EMP" as of timestamp to_timestamp('2023-02-15 17:15:00','yyyy-mm-dd hh24:mi:ss') where DEPTNO = '20')
误删表处理方法:
一,误删表
drop table 表名;
示例:
drop table EMP;
二,误删表的恢复语句
flashback table 表名 to before drop
示例:
flashback table "EMP" to before drop
查看数据库回收站里面已经删除的表
select * from user_recyclebin