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;

Flashback Data Archive ( Oracle Total Recall ) introduced in 11g的更多相关文章

  1. oracle闪回、闪回数据归档Flashback Data Archive (Oracle Total Recall)的真正强大之处、11gR2增强以及合理使用

    oracle的闪回很早就出来了,准确的说一直以来应该都较少被真正用户广为使用,除了dba和极少部分开发人员偶尔用于逻辑出错.误删恢复之外,较少被用于产生更有价值的用途. 各种闪回表flashback ...

  2. oracle flashback data archive闪回数据归档天坑之XID重用导致闪回查询数据重复

    我们有个系统使用了Oracle flashback data archive闪回数据归档特性来作为基于时间点的恢复机制,在频繁插入.更新期间发现SYS_FBA_HIST_NNNN表中的XID被两个事务 ...

  3. flashback data archive (转)

    闪回数据归档(Flashback Data Archive) 在Oracle 11g当中,对闪回技术再次进行了扩展,提供了一个全新的flashback方式,称之为闪回数据归档,本节我们将对闪回数据归档 ...

  4. [每日一题] 11gOCP 1z0-053 :2013-09-29 Flashback Data Archive ...................................6

    转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/12205299 正确答案:A 具体请参考:http://blog.csdn.net/guoy ...

  5. 11G新特性 -- flashback data archive(2)

    创建Flashback Data Archive用户需要授予dba或flashback archive administer系统特权.flashback archive administer系统特权包 ...

  6. 11G新特性 -- flashback data archive(1)

    虽然可以依赖undo数据来查询row的旧版本数据,甚至可以执行逻辑恢复.但是你不能期待在undo中找到非常旧的数据.undo数据主要是用来提供读一致性. 在11G中,提供了Flashback Data ...

  7. 闪回之 Flashback Data Archive

    背景:Oracle 11g 中 Flashback Data Archive 特性.将变化数据另外存储到创建的闪回归档区(Flashback Archive)中,以和 undo 区别开来,这样就可以为 ...

  8. [每日一题] 11gOCP 1z0-053 :2013-10-11 Flashback Data Archive属性.........................43

    转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/12656897 正确答案:BD 闪回数据归档请参考:http://blog.csdn.net ...

  9. Oracle 闪回归档(Flashback Data Archive)

    --检查权限 SELECT * FROM dba_sys_privs WHERE privilege LIKE '%FLASH%'; --设置权限 GRANT dba TO testuser;--设置 ...

随机推荐

  1. 关于Nginx的一些优化(突破十万并发)

    nginx指令中的优化(配置文件) worker_processes 8; nginx进程数,建议按照cpu数目来指定,一般为它的倍数. worker_cpu_affinity 00000001 00 ...

  2. virtualbox设置共享文件夹代替sftp同步代码

    通常的开发场景: 代码放在virtualbox上运行,本地的IDE通过sftp实现和虚拟机的代码同步. 有 一个不能避免的问题是,当使用git时,如果装在virtualbox端,那么每次virtual ...

  3. PHP陷阱,一些注意事项

    判断的一些注意事项 count(false) > 0 // true count(0) > 0 // true "随便一个字符串" == 0 // true " ...

  4. leetcode--Different Ways to Add Parentheses

    题目链接:https://leetcode.com/submissions/detail/86532557/ 算法类型:分治法 题目分析:计算表达式的所有结果可能性 代码实现: class Solut ...

  5. CSS布局奇淫技巧之--各种居中

    居中是我们使用css来布局时常遇到的情况.使用css来进行居中时,有时一个属性就能搞定,有时则需要一定的技巧才能兼容到所有浏览器,本文就居中的一些常用方法做个简单的介绍. 注:本文所讲方法除了特别说明 ...

  6. JS中用apply、bind实现为函数或者类传入动态个数的参数

    为纪念10年没写blog,第一篇博文就以这样一个有趣的窍门开始吧 -___- 在ES5中,当我们调用一个函数时,如果要传入的参数是根据其他函数或条件判断生成的,也就是说不确定会传入多少个参数时,在不改 ...

  7. Matplotlib——第一章轻松画个图

    首先安装matplotlib,使用pip install matplotlib.安装完成后在python的命令行敲入import matplotlib,如果没问题,说明安装成功可以开始画图了. 看好了 ...

  8. UESTC 1546 Bracket Sequence

                                        Bracket Sequence Time Limit: 3000MS   Memory Limit: 65536KB   64 ...

  9. JS判断网页是否在微信中打开/

    JS判断网页是否在微信中打开,代码如下: <script type="text/javascript"> function is_weixn(){ var ua = n ...

  10. windows下用visual studio code 调试go代码

    http://www.golangtc.com/download下载安装包或压缩包 配置环境变量 配置GOROOT: 配置PATH:在PATH最后添加 配置GOPATH:GOPATH的作用请自行百度, ...