WEB开发网
开发学院数据库Oracle Oracle数据库11g新特性:事务管理 阅读

Oracle数据库11g新特性:事务管理

 2008-12-16 13:03:10 来源:WEB开发网   
核心提示: elect txn_amtfrom transas of timestamp to_timestamp ('07/18/2007 12:39:00','mm/dd/yyyy hh24:mi:ss')where trans_id = 2; TXN_AMT--1

  elect txn_amt
from trans
as of timestamp to_timestamp ('07/18/2007 12:39:00','mm/dd/yyyy hh24:mi:ss')
where trans_id = 2;
   TXN_AMT
----------
 19325.67

现在,隔一段时间,当还原数据从还原段中清除后,再次查询这个闪回数据:

  select txn_amt
from trans
as of timestamp to_timestamp ('07/18/2007 12:39:00','mm/dd/yyyy hh24:mi:ss')
where trans_id = 2;

结果返回:19325.67. 还原数据已经清除了,那么这个数据来自何处呢?

我们问问 Oracle.您可以使用自动跟踪来查看执行计划:

  SQL> set autotrace traceonly explain
SQL> select txn_amt
 2 from trans
 3 as of timestamp to_timestamp ('07/18/2007 12:39:00','mm/dd/yyyy hh24:mi:ss')
 4 where trans_id = 2;
  Execution Plan
----------------------------------------------------------
Plan hash value: 535458644
  ----------------------------------------------------------
  | Id | Operation         | Name        | Rows | Bytes | Cost (%CPU)| Time   | Pstart| Pstop
-------------------------------------------------------------------------------------------------
|  0 | SELECT STATEMENT     |          |   2 |  52 |  10 (10)| 00:00:01 |    |
|  1 | VIEW           |          |   2 |  52 |  10 (10)| 00:00:01 |    |
|  2 |  UNION-ALL        |          |    |    |      |     |    |
|* 3 |  FILTER         |          |    |    |      |     |    |
|  4 |   PARTITION RANGE SINGLE|          |   1 |  52 |   3  (0)| 00:00:01 |   1 |   1
|* 5 |   TABLE ACCESS FULL  | SYS_FBA_HIST_68909 |   1 |  52 |   3  (0)| 00:00:01 |   1 |   1
|* 6 |  FILTER         |          |    |    |      |     |    |
|* 7 |   HASH JOIN OUTER    |          |   1 | 4053 |  10 (10)| 00:00:01 |    |
|* 8 |   TABLE ACCESS FULL  | TRANS       |   1 |  38 |   6  (0)| 00:00:01 |    |
|  9 |   VIEW         |          |   2 | 8030 |   3  (0)| 00:00:01 |    |
|* 10 |    TABLE ACCESS FULL  | SYS_FBA_TCRV_68909 |   2 | 8056 |   3  (0)| 00:00:01 |    |
-------------------------------------------------------------------------------------------------
  Predicate Information (identified by operation id):
---------------------------------------------------
   3 - filter(NULL IS NOT NULL)
  5 - filter("TRANS_ID"=2 AND "ENDSCN">161508784336056 AND "ENDSCN"<=1073451 AND ("STARTSCN" IS NULL
       OR "STARTSCN"<=161508784336056))
  6 - filter("F"."STARTSCN"<=161508784336056 OR "F"."STARTSCN" IS NULL)
  7 - access("T".ROWID=("F"."RID"(+)))
  8 - filter("T"."VERSIONS_STARTSCN" IS NULL AND "T"."TRANS_ID"=2)
 10 - filter(("ENDSCN" IS NULL OR "ENDSCN">1073451) AND ("STARTSCN" IS NULL OR "STARTSCN"<1073451))
  Note
-----
  - dynamic sampling used for this statement

该输出回答了我们的疑问“这个数据来自何处?”,数据来自表 SYS_FBA_HIST_68909,这是您先前为那个表定义的闪回存档中的某个位置。您可以查看这个表,但是 Oracle 不支持在那里直接查看数据。不过,我觉得您也没有必要那样做。

上一页  2 3 4 5 6 7 8 9  下一页

Tags:Oracle 数据库 特性

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接