01.Oracle 数据库误删除数据怎么恢复

数据误删除怎么恢复

SQL操作

  • 先查询数据,并确认where范围
select * from 表名 as of timestamp to_timestamp('删除时间点','yyyy-mm-dd hh24:mi:ss');
例如:
select * from student as of timestamp to_timestamp('20210412','yyyy-mm-dd hh24:mi:ss');
select * from student as of timestamp to_timestamp('20210412','yyyy-mm-dd hh24:mi:ss') where id = 1;
  • 插入数据
insert into 表名 ( select * from 表名  
       as of timestamp to_timestamp('删除时间点','yyyy-mm-dd hh24:mi:ss'  )
 );
例如:
insert into student ( select * from student 
       as of timestamp to_timestamp('20210412','yyyy-mm-dd hh24:mi:ss'  )
 );
insert into student ( select * from student 
       as of timestamp to_timestamp('20210412','yyyy-mm-dd hh24:mi:ss'  )
 ) where id = 1;
  • 后续待更新

你可能感兴趣的:(01.Oracle 数据库误删除数据怎么恢复)