zoukankan      html  css  js  c++  java
  • Oracle数据反向恢复

    1.Oracle 中truncate与delete的区别

    truncate与delete都是用来清空一个数据表

    truncate的删除的数据是不可恢复的,直接清除数据的储存空间,HWM设为初始值

    delete的删除在没有重启电脑前删除的数据是可以回复的,delete相当于把数据扔入了回收站,但是空间仍旧预留

    所以,在删除大数据量时使用truncate比delete效率要高得多

    2.delete的数据恢复

    先从flashback_transaction_query视图里查询,视图提供了供查询用的表名称,事务提交时间,UNDO_SQL等字段,如:select * from flashback_transaction_query where table_name='flashback_demo';

    一般先根据时间进行查询,查询语句模式为select * from flashback_demo as of timestamp to_timestamp('2011/11/11 11:11:11','yyyy-mm-dd hh24:mi:ss');

    若有数据,执行语句flashback table flashback_demo to timestamp to_timestamp('2011/11/11 11:11:11','yyyy-mm-dd hh24:mi:ss');

    以上操作需要开启数据库的闪回功能,如果没有开启,则需要执行对flashback_transaction_query表中的UNDO_SQL字段进行拼接,并在commandWindow中进行手动恢复

    执行语句select t.undo_sql from flashback_transaction_query t where t.start_timestamp =to_timestamp('2011/11/11 11:11:11','yyyy-mm-dd hh24:mi:ss');

    把所有需要的数据复制到commandWindow中,F8,恢复成功

  • 相关阅读:
    (Problem 14)Longest Collatz sequence
    (Problem 13)Large sum
    (Problem 10)Summation of primes
    (Problem 9)Special Pythagorean triplet
    (Problem 7)10001st prime
    (Problem 6)Sum square difference
    数组
    断点及复习
    抽象和封装
    类和对象
  • 原文地址:https://www.cnblogs.com/otomii/p/1950598.html
Copyright © 2011-2022 走看看