Oracle闪回查询总结
发布日期:2021-05-10 15:54:07 浏览次数:9 分类:精选文章

本文共 5532 字,大约阅读时间需要 18 分钟。

Oracle������������������������������������������������������������������DBA������������������������������������������������AUM������������������������������������������Oracle������������������������������

1.���������������������������

���Oracle 9i������������������������������������������������������������������������������������������������������������������������������������������������������������SCN���������������������������������������������������������������������������������������������������������������������������

2.������������������

���������������Oracle���������������������������������������������������������������������������������������������������������

  • ������������������������������ROLLBACK������������Oracle���������������������������������������������������������������������
  • ���������������������������������������������������������������������������������������������Oracle������������������������������������������������������������������������
  • ���������������������������������������������������������������������������������������������������������������������������������������

3.������������������������������

Oracle���DELETE���COMMIT������������������������������������������������������������������������������

  • ���������������������

  • Oracle������������������������������������
  • ���������������������������������DELETE���������������������
  • ������������������������������������������������
  • ������������������������������������
  • ���������������������������������dirty���������������������������������������
  • ���������������������

  • Oracle���������������������������������SCN������
  • ���������������������������������������������������������committed������
  • ���������������������������������������������������������������������������

4.���������������������������

���������������������������������������������������������������������������

  • ������������

    • ���������������UNDO_MANAGEMENT=AUTO���UNDO_RETENTION= n���n���������������������������������
    • ������sysdba���������������������������������������������������������
      conn sys/sys as sysdba  create user flash identified by flash;  grant connect, resource to flash;  grant execute on dbms_flashback to flash;
  • ������������

    • ���������������������������
      create table t_flash (test varchar2(10));  insert into t_flash values('google');  insert into t_flash values('KingXt');
    • ������������������������������
      delete t_flash where test = 'google';  commit;
    • ���������������������
      execute dbms_flashback.enable_at_time(to_date('2010-05-08 17:00:00','yyyy-mm-dd hh24:mi:ss'));  execute dbms_flashback.disable;
  • ������������

    • ���������������������������������
      cursor flash_recover is select * from t_flash;  t_recode t_flash%rowtype;  begin  dbms_flashback.enable_at_time(to_date('2010-05-08 20:35:23','yyyy-mm-dd hh24:mi:ss'));  open FLASH_RECOVER;  dbms_flashback.disable;  loop  fetch FLASH_RECOVER into t_recode;  exit when FLASH_RECOVER%notfound;  insert into t_flash values (t_recode.test);  end loop;  close FLASH_RECOVER;  commit;  end;
  • 5.������������������������

    • ���5������������������SCN������������������������������������������������������������SCN���������������������
    • ���������������������������������������_used_ ������������ ��������������������������������������������UNDO_RETENTION������������������������������

    6.Flashback Database

    Flashback Database���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

    flashback database to time to_timestamp(xxx);  flashback database to scn xxx;

    7.Flashback Table

    Flashback Table������������������������������������������������������������������������������������������������������������������

  • ������������������������

    flashback table test to timestamp to_timestamp('2010-05-08 17:00:00','yyyy-mm-dd hh24:mi:ss');
  • ������������������

  • flashback table test to timestamp to_timestamp('2010-05-08 17:00:00','yyyy-mm-dd hh24:mi:ss');

    ### 8.Flashback Drop  Flashback Drop���������������������������������������������������������������������������������������������������1. **���������������������**���  ```sqlshow recyclebin;
    1. ������������������������������������

      drop table test_drop;  show recyclebin;
    2. ������������������������

      flashback table test_drop to before drop;
    3. 9.Flashback Version Query

      Flashback Version Query���������������������������������������������������������������������������������������������

    4. ���������������������

      select versions_starttime, versions_operation, test from t_flash versions between minvalue and maxvalue order by versions_starttime;
    5. ���������������������������������

      select test from t_flash versions between timestamp to_date('2010-05-07 15:30:00', 'yyyy-mm-dd hh24:mi:ss') and to_date('2010-05-07 16:30:00', 'yyyy-mm-dd hh24:mi:ss');
    6. 10.Flashback Transaction Query

      Flashback Transaction Query���������������������������������������������������������������������������

    7. ������������ID���

      delete from test where id=2;  commit;  select xid from v$transaction;  XID ---------------- 04001200AE010000
    8. ���������������

      select * from FLASHBACK_TRANSACTION_QUERY where xid='04001F0035000000';
    9. ���������������

      ������������������������ID���������������������������������

    10. ������

      Oracle������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

    上一篇:Linux查看实时网卡流量的几种方式
    下一篇:1-2+3-4+5-6+7......+n的几种实现

    发表评论

    最新留言

    路过按个爪印,很不错,赞一个!
    [***.219.124.196]2025年04月17日 19时49分04秒