zoukankan      html  css  js  c++  java
  • Oracle学习笔记之误删数据恢复

    前记:改bug的时候一不小心误删了生成库上的一条数据,吓的小心脏直跳,幸好找回来了。

    如果是刚刚删除 可以采用以下方法:

    首先用以下 命令查看当时的数据库参数undo_retention设置。

    show parameter undo;

    显示如下:

    undo_management string AUTO
    undo_retention integer
    900
    undo_tablespace string UNDOTBS1

     undo_retention(保持力)900单位是秒。即15分钟

      修改默认的undo_retention参数设置:

    ALTER SYSTEM SET undo_retention=10800 SCOPE=BOTH;

    1.如果是删除了数据

     进行查询闪回如:

    select * from order_list as of timestamp to_timestamp('2013-05-29 09:33:00', 'yyyy-mm-dd hh24:mi:ss') where  pop='20130319016';

    然后闪回的数据重新插入到表中:

    insert into order_list(select * from order_list as of timestamp to_timestamp('2013-05-29 09:33:00', 'yyyy-mm-dd hh24:mi:ss') where  pop='20130319016');

     你也可以建一个临时表将数据全部恢复到临时表中

    上面的那个时间点是误删之前的时间,最好是十分接近的时间

    2. 如果是表删除了 

      恢复被删除的基表

    Flashback Table 表名 To Before Drop;
  • 相关阅读:
    Python获取 东方财富 7x24小时全球快讯
    Elasticsearch 环境配置
    可执行jar包与依赖jar包
    IDEA注释模板
    CKEditor
    解决让浏览器兼容ES6特性
    asp.net一个非常简单的分页
    Asp.Net真分页技术
    jsp选项卡导航实现——模板
    nodejs类比Java中:JVM
  • 原文地址:https://www.cnblogs.com/heshan664754022/p/3107576.html
Copyright © 2011-2022 走看看