oracle恢复删除的数据

分为两种方法:scn和时间戳两种方法恢复。html

1、经过scn恢复删除且已提交的数据数据库

  一、得到当前数据库的scn号ide

    select current_scn from v$database; (切换到sys用户或system用户查询) spa

    查询到的scn号为:1499223orm

  二、查询当前scn号以前的scnhtm

    select * from 表名 as of scn 1499220; (肯定删除的数据是否存在,若是存在,则恢复数据;若是不是,则继续缩小scn号)blog

  三、恢复删除且已提交的数据get

    flashback table 表名 to scn 1499220;flash

2、经过时间恢复删除且已提交的数据it

  一、查询当前系统时间

    select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

  二、查询删除数据的时间点的数据

    select * from 表名 as of timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');  (若是不是,则继续缩小范围)

  三、恢复删除且已提交的数据

    flashback table 表名 to timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');

    注意:若是在执行上面的语句,出现错误。能够尝试执行 alter table 表名 enable row movement; //容许更改时间戳


j_0048.gif


转载连接:http://www.cnblogs.com/kangxuebin/archive/2013/05/29/3106183.html

相关文章
相关标签/搜索