Oracle Flashback Technology【闪回技术】
-------------------------与其他数据库相比,Oracle的闪回让开发者多了一条选择的路。
Flashback的目的
Oracle Flashback Technology is a group of Oracle Database features that that let you view past states of database objects or to return database objects to a previous state without using point-in-time media recovery. |
- Flashback Query (引入自Oracle 9i)
- Flashback Table (引入自 Oracle 10g)
- Flashback Drop (引入自 Oracle 10g)
- Flashback Version Query (引入自Oracle 10g)
- Flashback Transaction Query (引入自Oracle 10g)
- Flashback Database (引入自Oracle 10g)
- Flashback Data Archive (引入自Oracle 11g)
- Flashback Transaction (引入自Oracle 11g)
Flashback Query useful to view the data at a point-in-time in the past. This can be used (only) to view and reconstruct lost data that was deleted or changed by accident.
Flashback Table useful to recover a table to a point-in-time in the past without restoring a backup. Flashback Table is a push button solution to restore the contents of a table to a given point-in-time. An application on top of
Flashback Query can achieve this, but with less efficiency.
Flashback Drop provides a way to restore accidentally dropped tables. This will be done with the help of Recyclebin feature.
Flashback Version Query uses undo data stored in the database to view the changes to one or more rows along with all the metadata of the changes.
Flashback Transaction Query useful to examine changes to the database at the transaction level. As a result, we can diagnose problems, perform analysis and audit transactions.
Flashback Database useful to bring database to a prior point in time by undoing all the changes that have taken place since that time. This operation is fast, because we do not need to restore the backups. This in turn results
in much less downtime following data corruption or human error. Flashback Database applies to the entire database. It requires configuration and resources, but it provides a fast alternative to performing incomplete database recovery.
Flashback Data Archive - from Oracle 11g, flashback will make use of flashback logs, explicitly created for that table, in FRA (Flash/Fast Recovery Area), will not use undo. Flashback data archives can be defined on any table/tablespace.
Flashback data archives are written by a dedicated background process called FBDA so there is less impact on performance. Can be purged at regular intervals automatically.
SQL> alter session set nls_date_format='yyyy-mm-dd:hh24:mi:ss';
Session altered SQL> select * from scott.emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
7369 SMITH CLERK 7902 1980/12/17 800.00 20
7499 ALLEN SALESMAN 7698 1981/2/20 1600.00 300.00 30
7521 WARD SALESMAN 7698 1981/2/22 1250.00 500.00 30
7566 JONES MANAGER 7839 1981/4/2 2975.00 20
7654 MARTIN SALESMAN 7698 1981/9/28 1250.00 1400.00 30
7698 BLAKE MANAGER 7839 1981/5/1 2850.00 30
7782 CLARK MANAGER 7839 1981/6/9 2450.00 10
7788 SCOTT ANALYST 7566 1987/4/19 3000.00 20
7839 KING PRESIDENT 1981/11/17 5000.00 10
7844 TURNER SALESMAN 7698 1981/9/8 1500.00 0.00 30
7876 ADAMS CLERK 7788 1987/5/23 1100.00 20
7900 JAMES CLERK 7698 1981/12/3 950.00 30
7902 FORD ANALYST 7566 1981/12/3 3000.00 20
7934 MILLER CLERK 7782 1982/1/23 1300.00 10
14 rows selected SQL> create table test1 as (select * from scott.emp);
Table created SQL> select sysdate from dual;
SYSDATE
-----------
2015/7/19 15:22:17 --这里DBA误操作,误删除了test1业务表,并且执行了commit
SQL> delete from test1;
14 rows deleted SQL> commit;
Commit complete
此时test1表中已经没有数据了
SQL> select * from test1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------ SQL>
但我们依然可以通过Flashback Query查询之前被删除的数据:
SQL> select * from test1 as of timestamp to_timestamp('2015-07-19:15:22:17','yyyy-mm-dd:hh24:mi:ss');
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
7369 SMITH CLERK 7902 1980/12/17 800.00 20
7499 ALLEN SALESMAN 7698 1981/2/20 1600.00 300.00 30
7521 WARD SALESMAN 7698 1981/2/22 1250.00 500.00 30
7566 JONES MANAGER 7839 1981/4/2 2975.00 20
7654 MARTIN SALESMAN 7698 1981/9/28 1250.00 1400.00 30
7698 BLAKE MANAGER 7839 1981/5/1 2850.00 30
7782 CLARK MANAGER 7839 1981/6/9 2450.00 10
7788 SCOTT ANALYST 7566 1987/4/19 3000.00 20
7839 KING PRESIDENT 1981/11/17 5000.00 10
7844 TURNER SALESMAN 7698 1981/9/8 1500.00 0.00 30
7876 ADAMS CLERK 7788 1987/5/23 1100.00 20
7900 JAMES CLERK 7698 1981/12/3 950.00 30
7902 FORD ANALYST 7566 1981/12/3 3000.00 20
7934 MILLER CLERK 7782 1982/1/23 1300.00 10
14 rows selected SQL>
如果需要,还可以恢复数据:
SQL> insert into test1 select * from test1 as of timestamp to_timestamp('2015-07-19:15:22:17','yyyy-mm-dd:hh24:mi:ss');
14 rows inserted SQL> commit;
而借助Flashback Database特性,可以进行这样的恢复
其实Flashback Logs并不神秘,与所有的日志文件功能相同,它也是用来记录日志。只不过这个日志保存的信息比较特别,并不简单记录做过什么的操作,而是记录下操作执行前要修改的数据,即数据块的前映像。这些信息被写入一个专用存储区叫Flash Recovery Area,简称FRA。当需要Flashback Database时,通过Flashback Log中保存的数据,就可以快速将Oracle数据库恢复到指定时间点块的状态,然后再通过应用重做日志,将数据库恢复到一致性状态。
Flashback Log的创建、删除、修改都由Oracle自动进行,完全无须DBA手工干预,唯一需要DBA介入的,就是给Flash Recovery Area分配适当的空间。
版权声明:本文为博主原创文章,未经博主允许不得转载。
Oracle Flashback Technology【闪回技术】的更多相关文章
- Oracle Flashback Technologies - 闪回查询
Oracle Flashback Technologies - 闪回查询 查看表中,某行数据的修改记录 #创建一个表,并插入和修改数据 SQL> create table y3(id )); T ...
- Oracle Flashback Technologies - 闪回被drop的表
Oracle Flashback Technologies - 闪回被drop的表 在oracle10g中,drop一个表后,表没有真正被删除,支持被rename后放在recyclebin中. #新建 ...
- Oracle Flashback Technologies - 闪回数据库
Oracle Flashback Technologies - 闪回数据库 根据指定的SCN,使用rman闪回数据库 #查看可以闪回到多久前 SQL> select * from v$flash ...
- oracle 基础(一)--闪回技术
一,闪回表初探 闪回须知: 1 使用闪回表注意如下事项: 2 3 (1)被闪回的表必须启用行移动功能 4 5 SQL> alter table dept enable row movement; ...
- 吴裕雄--天生自然ORACLE数据库学习笔记:Oracle 11g的闪回技术
alter system set db_recovery_file_dest_size=4g scope=both; connect system/1qaz2wsx as sysdba; archiv ...
- Oracle 六闪回技术,flashback
Flashback 技术基于Undo segment基于内容的, 因此,限制UNDO_RETENTON参数. 要使用flashback 特征,您必须启用自己主动撤销管理表空间. 在Oracle 11g ...
- Oracle闪回技术(Flashback)
闪回技术有闪回表.闪回删除.闪回查询.闪回事务查询.闪回事务.闪回数据库.闪回数据归档.其中,闪回查询.闪回事务查询用来“观察”过去:闪回数据归档并不是一个独立的功能,其功能是扩展闪回查询的时间窗口: ...
- Oracle 的闪回技术 --flashback
SQL Fundamentals: 表的创建和管理 如何开启数据库闪回? SQL> shutdown immediate; ORA-01109: database not open Databa ...
- Oracle闪回技术详解
概述: 闪回技术是Oracle强大数据库备份恢复机制的一部分,在数据库发生逻辑错误的时候,闪回技术能提供快速且最小损失的恢复(多数闪回功能都能在数据库联机状态下完成).需要注意的是,闪回技术旨在快速 ...
随机推荐
- Jasper:API / API 策略和最佳做法
ylbtech-Jasper:API / API 策略和最佳做法 1.返回顶部 1. API 策略和最佳做法 Cisco Jasper 已经建立了一项 API 公平使用策略,确保所有 Control ...
- virtualBox中的centOS虚拟机硬盘扩容
1. 在virtualBox中给虚拟机添加虚拟硬盘 此时. 已经将yanwu_disk1.vdi 虚拟硬盘添加到了虚拟机中, 接下来就是进行硬盘的挂载 https://www.cnblogs.com/ ...
- 2.12 Hivet中order by,sort by、distribute by和cluster by
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+SortBy 一.order by 对全局数据的排序,仅仅只有一个red ...
- QDUOJ 东北大炸弹 宝岛地图-枚举+数组记录+前缀和
冰清玉洁丶YCB 发布时间: 2017年6月18日 21:39 最后更新: 2017年6月18日 21:40 时间限制: 1000ms 内存限制: 256M 描述 YCB是公认的冰清玉洁, ...
- HDU4248【DP】
题意: 有n种石头,每种石头有a[i]个,然后让你去组合,问有多少种组合: 思路: 这种题,排列组合知识一上,非常麻烦,已经搞了好几题,看似就是排列组合的姿势,然而最终都是一种递推,也就是DP,而且比 ...
- Unity2D研究院之自动生成动画、AnimationController、Prefab(一)
http://www.xuanyusong.com/archives/3243 国庆了,回家了.时刻还是要吃一颗学习的心,在家了也要抽出时间好好学习一下.之前MOMO一直没研究过Unity2D,今天研 ...
- CSS优先级、CSS选择器、编写CSS时的注意事项
CSS的优先级: 内嵌样式>ID选择器>类选择器>标签选择器 内部样式>内部样式>外部样式 CSS的选择器: 选择器:在 CSS 中,选择器是一种模式,用于选择需要添加样 ...
- Aandroid 解决apk打包过程中出现的“Certificate for <jcenter.bintray.com> doesn't match any of the subject alternative names: [*.aktana.com, aktana.com]”的问题
有时候,apk打包过程中会出现“Certificate for <jcenter.bintray.com> doesn't match any of the subject alterna ...
- MyBatist庖丁解牛(一)
站在巨人的肩膀上,感谢! https://www.jianshu.com/p/ec40a82cae28?utm_campaign=maleskine&utm_content=note& ...
- bzoj2825:[AHOI2012]收集资源
传送门 看到数据范围这么小,就没想过暴力的办法么 考虑肯定是从近走到远,所以走的点之间一定没有其他的点,所以我们就可以暴力的建图,然后暴力的去dfs就好了 代码: #include<cstdio ...