create table person(
id varchar2(32),
username varchar2(34),
age number
)
--插入数据
insert into person values('1','张三',23);
insert into person values('2','李四',25)
--有时候我们为了方便处理Oracle的垃圾数据会使用delete语句进行数的删除
delete from person where id='2'
--但是有时候会删错数据,这是需要进行数据的恢复了,以下是数据的恢复的语句
--(1)使用时间戳的办法进行恢复
insert into person(
select * from person
as of timestamp to_timestamp('2019.03.05 10:54:23','yyyy.mm.dd hh24:mi:ss')
where id='2'
)
--注意:表中的主键不能有冲突
--(2)使用表闪回的方法
--注意表闪回要求用户必须要有flash any table权限
--1,开启行移动功能
alter table person enable row movement
--2,恢复表数据
flashback table person to timestamp to_timestamp('2019.03.05 11:04:00','yyyy.mm.dd hh24:mi:ss')
--3,关闭行移动功能
alter table person disable row movement