zoukankan      html  css  js  c++  java
  • oracle恢复已删除数据

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

    一、通过scn恢复删除且已提交的数据

      1、获得当前数据库的scn

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

        查询到的scn号为:1499223

      2、查询当前scn号之前的scn

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

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

        flashback table 表名 to scn 1499220;

    二、通过时间恢复删除且已提交的数据

      1、查询当前系统时间

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

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

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

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

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

        注意:如果在执行上面的语句,出现错误。可以尝试执行 alter table 表名 enable row movement; //允许更改时间戳

    注意问题:

    oralce 表闪回操作 ORA-08189: cannot flashback the table becau

    解决方案:alter table table_name enable row movement;

    找回时间过长

    解决方案:调整时间近一些

  • 相关阅读:
    <!DOCTYPE html>的重要性!
    ibatis 常用标签
    string.match(RegExp) 与 RegExp.exec(string) 深入详解
    JavaScript RegExp.$1
    JavaScript RegExp.exec() 方法
    正则表达式常用符号说明
    正则表达式中/i,/g,/ig,/gi,/m的区别和含义
    JavaScript Math.floor() 方法
    JavaScript RegExp.test() 方法
    js日期格式化 扩展Date()
  • 原文地址:https://www.cnblogs.com/hkdpp/p/8301670.html
Copyright © 2011-2022 走看看