zoukankan      html  css  js  c++  java
  • Flashback Data Archive ( Oracle Total Recall ) introduced in 11g

    Flashback Data Archive feature is part of Oracle Total Recall technology. Flashback Data Archive feature lets you to track changes made in any number of tables for any given retention time. The retention time can be some days or months or years.

    Flashback data archives retain historical data for the time duration specified using the RETENTIONparameter. Historical data can be queried using the Flashback Query AS OF clause. Archived historic data that has aged beyond the specified retention period is automatically purged.

    This feature is supported only Oracle 11g Enterprise Edition. It is not available in Standard or Express editions.

    Lets see an example.

    Step 1:- Create Flashback data archive tablespace.

    1. SQL> select * from v$version;
    2. BANNER
    3. --------------------------------------------------------------------------------
    4. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    5. PL/SQL Release 11.2.0.4.0 - Production
    6. CORE 11.2.0.4.0 Production
    7. TNS for Linux: Version 11.2.0.4.0 - Production
    8. NLSRTL Version 11.2.0.4.0 - Production
    9. SQL> create tablespace FB_Storage datafile '/u01/app/oracle11g/oradata/DB11/datafile/fdstore.dbf'
    10. 2 size 100m autoextend on segment space management auto;
    11. Tablespace created.

    Step 2:- Create Flashback Archive

    1. SQL> create flashback archive default FB_Arch1 tablespace FB_Storage quota 1g retention 1 year;
    2. Flashback archive created.

    Step 3:- Turn on Flashback archive for tables you want to track.

    For Example to enable flashback archive for table Scott.emp

    (i) Grant Flashback archive privilege

    1. SQL> grant flashback archive on fb_arch1 to scott;
    2. Grant succeeded.
    3. SQL> connect scott/tiger
    4. Connected.

    (ii) Enable flashback archive for table

    1. SQL> alter table emp flashback archive;
    2. Table altered.

    Step 4:- Flashback Example.

    Suppose a user has deleted rows from emp by giving a delete statement like this

    1. SQL> set time on
    2. 19:57:32 SQL> select * from emp;
    3. DEPTNO DNAME LOC
    4. ---------- -------------- -------------
    5. 20 RESEARCH DALLAS
    6. 30 SALES CHICAGO
    7. 40 OPERATIONS BOSTON
    8. 19:57:56 SQL>
    9. 19:57:59 SQL>
    10. 19:57:59 SQL>
    11. 19:57:59 SQL>
    12. 19:57:59 SQL> delete from emp where deptno=30;
    13. 1 row deleted.
    14. 19:58:25 SQL> commit;
    15. Commit complete.

    To View the state of table emp 10 minutes before

    1. 19:58:29 SQL> select * from emp as of timestamp sysdate - 10 / (24*60);
    2. DEPTNO DNAME LOC
    3. ---------- -------------- -------------
    4. 10 ACCOUNTING NEW YORK
    5. 20 RESEARCH DALLAS
    6. 30 SALES CHICAGO
    7. 40 OPERATIONS BOSTON

    Versions Query (11gR2 only) (To see what changes are made to Emp No. 7902 between last 15 minutes

    1. 22:18:34 SQL> select * from emp versions between
    2. timestamp sysdate- 15 /(24*60) and sysdate
    3. where empno=7902;




  • 相关阅读:
    QT中使用CoInitializeEx
    Linux 声音采集的时候内容全都是0
    linux类似系统中编译依赖库出现error trying to exec cc1plus
    C语言练习题2
    进程和任务计划管理
    解决火车头7.6版本无法采集部分https网站处理方法
    PHP输出13位时间戳函数
    destoon取消公司名称怎重复注册的限制
    destoon取消公司名称怎重复注册的限制
    destoon伪静态地址空值优化
  • 原文地址:https://www.cnblogs.com/haoxiaoyu/p/47d098cb7377f8b527330feb93d63e93.html
Copyright © 2011-2022 走看看