ORACLE 10G 闪回建议
Flashback Tips
The following tips and restrictions apply to using flashback features.
Flashback Tips – Performance
For better performance, generate statistics on all tables involved in a Flashback Query by using the
DBMS_STATS
package, and keep the statistics current. Flashback Query always uses the cost-based optimizer, which relies on these statistics.为了获得更好的性能,用dbms_stats收集统计所有在闪回查询中要应用的表并且保持这些信息最新。闪回查询总是使用基于成本的优化,这依赖于这些统计数据。
The performance of a query into the past depends on how much undo data must be accessed. For better performance, use queries to select small sets of past data using indexes, not to scan entire tables. If you must do a full table scan, consider adding a parallel hint to the query.
一个查询到过去的取决于多少的undo数据需要访问。为了获得更好的性能,利用 索引来查询。如果你必须做一次全表扫描,可以考虑添加一个并行提示查询
The performance cost in I/O is the cost of paging in data and undo blocks that are not already in the buffer cache. The performance cost in CPU use is the cost of applying undo information to affected data blocks. When operating on changes in the recent past, flashback features essentially CPU bound.
在I/O性能成本是分布数据的成本和undo块不是已经在缓冲区高速缓存块。在CPU使用性能成本将undo信息的数据块的成本的影响。操作时,在最近的过去的变化,闪回功能基本上CPU绑定。
Use index structures for Flashback Version Query: the database keeps undo data for index changes as well as data changes. Performance of index lookup-based Flashback Version Query is an order of magnitude faster than the full table scans that are otherwise needed.
使用索引结构的闪回版本查询:数据库保存索引及数据库在 undo中。索引查找基于性能的闪回版本查询是一个数量级的速度比其他需要全表扫描要快。
In a Flashback Transaction Query, the type of the
xid
column isRAW(8)
. To take advantage of the index built on thexid
column, use theHEXTORAW
conversion function:HEXTORAW(xid)
.闪回事务查询 中,列名xid属性为RAW,利用 xid列建立索引,可以用hextoraw函数 转换
Flashback Query against a materialized view does not take advantage of query rewrite optimizations.
闪回查询物化视图不利于查询重写优化
See Also:
Flashback Tips – General
Use the
DBMS_FLASHBACK
package or other flashback features? UseENABLE
/DISABLE
calls to theDBMS_FLASHBACK
package around SQL code that you do not control, or when you want to use the same past time for several consecutive queries. Use Flashback Query, Flashback Version Query, or Flashback Transaction Query for SQL that you write, for convenience. A Flashback Query, for example, is flexible enough to do comparisons and store results in a single query.To obtain an SCN to use later with a flashback feature, use
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER
.You can compute or retrieve a past time to use in a query by using a function return value as a timestamp or SCN argument. For example, you can perform date and time calculations by adding or subtracting an
INTERVAL
value to the value of theSYSTIMESTAMP
function.You can query locally or remotely (Flashback Query, Flashback Version Query, or Flashback Transaction Query). for example here is a remote Flashback Query:
(SELECT * FROM employees@some_remote_host AS OF
TIMESTAMP (SYSTIMESTAMP - INTERVAL '60' MINUTE);闪回查询,闪回事物查询,闪回版本查询可以用于本地或者是远程
To ensure database consistency, always perform a
COMMIT
orROLLBACK
operation before querying past data.为了保证数据库的一致性,始终执行COMMIT或ROLLBACK操作前查询之前的数据。
Remember that all flashback processing is done using the current session settings, such as national language and character set, not the settings that were in effect at the time being queried.
记住,所有的闪回操作是通过使用当前会话的设置,如国家语言和字符集,而不受当时被查询的影响。
Some DDLs that alter the structure of a table, such as drop/modify column, move table, drop partition, and truncate table/partition, invalidate any existing undo data for the table. It is not possible to retrieve data from a point earlier than the time such DDLs were executed. Trying such a query results in error ORA-1466. This restriction does not apply to DDL operations that alter the storage attributes of a table, such as
PCTFREE
,INITRANS
, andMAXTRANS
.一些操作,改变表的结构,如删除/修改列的表,移动,删除分区,并截断表/分区,对于这张表上的任意undo数据是无效的。不可能从早于这个时间点恢复如dll操作,如果出现此操作,将会报ora-1466错误。该限制不适用于DDL操作变更表的存储属性,如pctfree,initrans,和maxtrans。
Use an SCN to query past data at a precise time. If you use a timestamp, the actual time queried might be up to 3 seconds earlier than the time you specify. Internally, Oracle Database uses SCNs; these are mapped to timestamps at a granularity of every 3 seconds.
使用一个SCN查询过去的数据在一个精确的时间。如果你使用一个时间戳,实时查询可能长达3秒,比您指定的时间。在内部,Oracle数据库使用SCN;这些被映射到时间戳的粒度为每3秒。
For example, assume that the SCN values 1000 and 1005 are mapped to the times 8:41 and 8:46 AM respectively. A query for a time between 8:41:00 and 8:45:59 AM is mapped to SCN 1000; a Flashback Query for 8:46 AM is mapped to SCN 1005.
例如,假设指定SCN值1000和1005映射到次41 8:46上午和8点46。一种8:41:00和8:45:59是之间的时间查询映射到SCN 1000;一种是8:46闪回查询映射到SCN 1005。
Due to this time-to-SCN mapping, if you specify a time that is slightly after a DDL operation (such as a table creation) the database might actually use an SCN that is just before the DDL operation. This can result in error ORA-1466.
在时间和scn映射上,如果 你指定的时间在DDL操作之后实际使用的scn在DDL操作之前,那么有可能 结果会产生ora-1466操作
You cannot retrieve past data from a
V$
view in the data dictionary. Performing a query on such a view always returns the current data. You can, however, perform queries on past data in other views of the data dictionary, such asUSER_TABLES
.你不能从一个视图在数据字典视图检索历史数据。对视图执行的查询是返回的当前数据。你可以,但是,执行对数据字典视图查询其他过去的数据,如user_tables
ORACLE 10G 闪回建议的更多相关文章
- 【Oracle】闪回技术
1.闪回技术描述 2.数据库的准备: --undo表空间要设置成AUTO,设置合适的保存时间.undo表空间: SYS@ENMOEDU> show parameter undo NAME TYP ...
- Oracle Flashback 闪回
Oracle 的闪回技术是一种数据恢复技术,仅能对用户逻辑错误进行恢复, 闪回针对的是提交commit的事务,没有提交的事务,使用rollback 1.闪回版本查询 Flashback Version ...
- Oracle的闪回特性之恢复truncate删除表的数据
Oracle的闪回特性之恢复truncate删除表的数据 SQL> show parameter flashback NAME T ...
- oracle的闪回功能
ORACLE的闪回功能: navicat 执行删改语句 不用提交直接执行? 感觉很恐怖? 今天一不下心手一滑 选错 结果把数据库的字段全改了 很慌 然后发现 oracle 有一个闪回功能 专门用来补天 ...
- [Oracle]Oracle的闪回归档
Oracle的闪回归档 场景需求,由于管理数据库的一些核心表,在实施初期会有人为误删除的问题.Oracle 11gR2提供了闪回归档的特性,可以保证不用RMAN来恢复误删除的数据.实践如下: 1.创建 ...
- Oracle 六闪回技术,flashback
Flashback 技术基于Undo segment基于内容的, 因此,限制UNDO_RETENTON参数. 要使用flashback 特征,您必须启用自己主动撤销管理表空间. 在Oracle 11g ...
- oracle之三闪回flashback
闪回 flashback 5.1 flashback 的功能:1)利用undo data回溯或撤销提交的数据,2)flashback log 使database 可以恢复到过去某个时间点,可以作为不完 ...
- Oracle的闪回操作
Oracle10g中引入了闪回技术,但这并不意味着所有的表都能闪回成功,当没有足够的磁盘空间,Oracle将使用回收站中的磁盘空间,而且位图连接索引和引用完整性约束也不受回收站的保护. recycle ...
- Oracle 的闪回技术 --flashback
SQL Fundamentals: 表的创建和管理 如何开启数据库闪回? SQL> shutdown immediate; ORA-01109: database not open Databa ...
随机推荐
- Python的平凡之路(5)
一.模块介绍 定义: 模块--用来从逻辑上组织python代码(变量,函数,类,逻辑:实现一个功能),本质就是.py结尾的python文件(文件名test.py,模块名test) 包—用来从逻辑上组织 ...
- eclipse新建安卓项目点击finish后窗口无法关闭
eclipse新建安卓项目点击finish后窗口不会自动关闭,而且工程会有很多报错: 如图,这个页面点击finish一直无法关闭,后来试了试,才发现是因为新建项目的第一个页面的sdk版本的问题: 这里 ...
- BackTrack5-r3硬盘安装
用Universal-USB-Installer-1.9.4.2这个工具,选择系统类型为Backtrack5 R3,选择Backtrack5 R3系统的ISO文件,然后选中U盘盘符,点击”Create ...
- iOS运行时与method swizzling
C语言是静态语言,它的工作方式是通过函数调用,这样在编译时我们就已经确定程序如何运行的.而Objective-C是动态语言,它并非通过调用类的方 法来执行功能,而是给对象发送消息,对象在接收到消息之后 ...
- 路由器DHCP 动态主机配置
进入ip设置:ip pool fw 添加网关gateway-list 192.168.1.1 添加网段network 192.168.1.0 mask 255.255.255.0 域名 dns-lis ...
- POJ 1511 Invitation Cards (spfa的邻接表)
Invitation Cards Time Limit : 16000/8000ms (Java/Other) Memory Limit : 524288/262144K (Java/Other) ...
- caffe的python接口
http://blog.csdn.net/lu597203933/article/details/46742199 hadoop改成自己名字
- 在Eclipse中配置Tomcat服务器
第一步:开启Eclipse,选择“servers”选项卡,点击下方新建server的链接. 如果找不到“server”选项卡,可以使用以下方法: 选择window--> show View -- ...
- js 函数和变量的提升
js 函数和变量的提升 1. 函数的作用域: js中 ,函数的作用域为函数,而不是大括号. var hei = 123;if(true){ hei = 456;}console.log(hei);// ...
- Boot loader: Grub进阶[转]
Boot loader: Grub进阶 本文记录grub的一些进阶配置 关於核心功能当中的 vga 配置 事实上,你的 tty1~tty6 除了 80x24 的解析度外,还能够有其他解析度的支持喔!但 ...