手机版
你好,游客 登录 注册
背景:
阅读新闻

Oracle的回闪查询

[日期:2013-01-19] 来源:Linux社区  作者:eric0435 [字体:大 中 小]

该视图的定义为:

select xid, start_scn, start_timestamp,

decode(commit_scn, 0, commit_scn, 281474976710655, NULL, commit_scn)

commit_scn, commit_timestamp,

logon_user, undo_change#, operation, table_name, table_owner,

row_id, undo_sql

from sys.x$ktuqqry;

对于x$ktuqqry的查询非常耗时

测试一下对于x$ktuqqry表的查询

SQL> select count(addr) from x$ktuqqry;

 


COUNT(ADDR)

-----------

74786

如果需要撤消xid=0300150096010000的事务,可以通过如下步骤进行:

SQL> set autotrace on

SQL> select undo_sql from flashback_transaction_query where xid='0300150096010000';

 


UNDO_SQL

--------------------------------------------------------------------------------

delete from "SYS"."TEST" where ROWID = 'AAAM3VAABAAAO9KAAd';

 

 

 

 


Execution Plan

----------------------------------------------------------

Plan hash value: 1115820779

 


------------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |

------------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 1 | 2008 | 0 (0)| 00:00:01 |

|* 1 | FIXED TABLE FULL| X$KTUQQRY | 1 | 2008 | 0 (0)| 00:00:01 |

------------------------------------------------------------------------------

 


Predicate Information (identified by operation id):

---------------------------------------------------

 


1 - filter(RAWTOHEX("XID")='0300150096010000')

 

 

 

Statistics

----------------------------------------------------------

90926 recursive calls

0 db block gets

238964 consistent gets

21783 physical reads

0 redo size

506 bytes sent via SQL*Net to client

385 bytes received via SQL*Net from client

2 SQL*Net roundtrips to/from client

4115 sorts (memory)

0 sorts (disk)

2 rows processed

 


SQL>

通过执行相应的undo语句可以撤消该事务,通过这些新特性,Oracle提供了一种"回滚"提交事务的

方法,极大地方便了用户应对不同情况的数据库恢复.

linux
相关资讯       Oracle查询  Oracle回闪  Oracle回闪查询 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款