修改时间 21-NOV-2011     类型 BULLETIN     状态 PUBLISHED  

Applies to:

Oracle Server - Enterprise Edition - Version: 8.1.5.0 to 11.1.0.6 - Release: 8.1.5 to 11.1

Information in this document applies to any platform.

Purpose

The purpose of this bulletin is to assist support analysts in understanding and

resolving the stranded dba_2pc_entries.


Scope and Application

The intended audience are support analysts having good experience on distributed

databases.


How To Resolve Stranded DBA_2PC_PENDING Entries



set transaction use rollback segment SYSTEM;
delete from sys.pending_trans$ where local_tran_id = ;
delete from sys.pending_sessions$ where local_tran_id = ;
delete from sys.pending_sub_sessions$ where local_tran_id = ;
commit;

Example:
--------
The following query reports a dist. txn. in prepared state
select local_tran_id, state from dba_2pc_pending;
LOCAL_TRAN_ID STATE
---------------------- ----------------
1.92.66874 prepared

Given that a transaction id is composed of triple,
'1.92.66874' is located in rollback segment# 1. To find out the list of
active transactions in that rollback segment, use:

SELECT KTUXEUSN, KTUXESLT, KTUXESQN, /* Transaction ID */
KTUXESTA Status,
KTUXECFL Flags
FROM x$ktuxe
WHERE ktuxesta!='INACTIVE'
AND ktuxeusn= 1; <== this is the rollback segment#

no rows selected

It is not possible to rollback force or commit force this transaction.


rollback force '1.92.66874';

ORA-02058: no prepared transaction found with ID 1.92.66874

Hence, we have to manually cleanup that transaction:


set transaction use rollback segment SYSTEM;

delete from sys.pending_trans$
where local_tran_id = '1.92.66874';

delete from sys.pending_sessions$ where local_tran_id = '1.92.66874';

delete from sys.pending_sub_sessions$ where local_tran_id = '1.92.66874';

commit;

2.2 Distributed transaction without corresponding dba_2pc entries

In this case dba_2pc views are empty but users are receiving distributed txn
related errors, e.g. ORA-2054, ORA-1591. Normally such a case should not appear
and if it is reproducible a bug should be filed. Here is the list of several
alternative solutions that can be used in this case:

a. Perform. incomplete recovery
b. Truncate the objects referenced by that transaction and import them
c. Use _corrupted_rollback_segments parameter to drop that rollback segment
d. Insert dummy entries into dba_2pc views and either commit or rollback
force the distributed transaction

The first three solutions are discussed in Backup and Recovery manuals and in
the notes referred above. In the 4th solution a dummy entry is inserted into
the dictionary so that the transaction can be manually committed or rolled back.
Note that RECO will not be able to process this txn and distributed txn recovery
should be disabled before using this method. Furthermore, please take a BACKUP
of your database before using this method.

The stranded entries is the cause of ORA-01591 so we need to
clear the stranded entries by purging them using

execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('transanction_id');

The following example describes how to diagnose and resolve this case. Suppose
that users are receiving


ORA-1591: lock held by in-doubt distributed transaction 1.92.66874

and the following query returns no rows:


select local_tran_id, state from dba_2pc_pending
where local_tran_id='1.92.66874';

no rows selected

Furthermore querying the rollback segment shows that 1.92.66874 remains in
prepared state


SELECT KTUXEUSN, KTUXESLT, KTUXESQN, /* Transaction ID */
KTUXESTA Status,
KTUXECFL Flags
FROM x$ktuxe
WHERE ktuxesta!='INACTIVE'
AND ktuxeusn= 1; /* <== Replace this value with your txn undo seg#
Which is displayed in the first part of
the transaction ID */

KTUXEUSN KTUXESLT KTUXESQN STATUS FLAGS
---------- ---------- ---------- ---------------- ------------------------
1 92 66874 PREPARED SCO|COL|REV|DEAD

Trying to manually commit or rollback this transaction


commit force '1.92.66874';

ORA-02058: no prepared transaction found with ID 1.92.66874

raises ORA-02058 since dba_2pc views are empty. In order to use commit force or
rollback force a dummy record should be inserted into pending_trans$ as follows:


alter system disable distributed recovery;

insert into pending_trans$ (
LOCAL_TRAN_ID,
GLOBAL_TRAN_FMT,
GLOBAL_ORACLE_ID,
STATE,
STATUS,
SESSION_VECTOR,
RECO_VECTOR,
TYPE#,
FAIL_TIME,
RECO_TIME)
values( '1.92.66874', /* <== Replace this with your local tran id */
306206, /* */
'XXXXXXX.12345.1.2.3', /* These values can be used without any */
'prepared','P', /* modification. Most of the values are */
hextoraw( '00000001' ), /* constant. */
hextoraw( '00000000' ), /* */
0, sysdate, sysdate );

insert into pending_sessions$
values( '1.92.66874',/* <==Replace only this with your local tran id */
1, hextoraw('05004F003A1500000104'),
'C', 0, 30258592, '',
146
);

commit;

commit force '1.92.66874';

If commit force raises an error then note the errormessage and execute the
following:


delete from pending_trans$ where local_tran_id='1.92.66874';
delete from pending_sessions$ where local_tran_id='1.92.66874';
commit;
alter system enable distributed recovery;

Otherwise run purge the dummy entry from the dictionary, using


alter system enable distributed recovery;
connect / as sysdba
COMMIT;
Use following query to retrieve the value for such _smu_debug_mod parameter:

col Parameter for a20
col "Session Value" for a20
col "Instance Value" for a20

SELECT a.ksppinm "Parameter",b.ksppstvl "Session Value",c.ksppstvl "Instance Value"
FROM x$ksppi a, x$ksppcv b, x$ksppsv c
WHERE a.indx = b.indx AND a.indx = c.indx AND a.ksppinm = '_smu_debug_mode'
/

-- set it temporarily to 4:

alter system set "_smu_debug_mode" = 4; /* if automatic undo management
is being used */
-- in 9.2x alter session can be used instead.

commit; /* this is to prevent the ORA-01453 in purge_lost_db_entry call */

exec dbms_transaction.purge_lost_db_entry( '1.92.66874' );

SQL> commit;

SQL> alter system set "_smu_debug_mode" = ;

SQL> commit;

2.3 How to PURGE the DISTRIBUTED transaction in PREPARED state, when COMMIT
or ROLLBACK FORCE hangs ?, where we have entries for both Distributed
transaction and dba_2pc entries.

ORA-01591: lock held by in-doubt distributed transaction 44.88.85589

The row exist from dba_2pc_pending & Rollback segment


SQL> SELECT LOCAL_TRAN_ID,STATE FROM DBA_2PC_PENDING;

LOCAL_TRAN_ID STATE
----------------- -----------
44.88.85589 prepared

SQL> SELECT KTUXEUSN, KTUXESLT, KTUXESQN, /* Transaction ID */
KTUXESTA Status,
KTUXECFL Flags
FROM x$ktuxe
WHERE ktuxesta!='INACTIVE'
AND ktuxeusn= 44; /* <== Replace this value with your txn undo seg#
Which is displayed in the first part of
the transaction ID */

KTUXEUSN KTUXESLT KTUXESQN STATUS FLAGS
---------- ---------- ---------- ---------------- ------------------------
44 88 85589 PREPARED SCO|COL|REV|DEAD

SQL> Commit force 44.88.85589;
SQL> rollback force 44.88.85589;

Executing COMMIT or ROLLBACK FORCE hangs

The wait event is ""free global transaction table entry"

Purging the transaction should fail with below error:


EXECUTE DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('44.88.85589');
BEGIN DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('44.88.85589'); END;

*
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.DBMS_TRANSACTION", line 94
ORA-06512: at line 1

Solution:
--------

You have to implement both the solution :

2.1 Dba_2pc entries without a corresponding transaction
2.2 Distributed transaction without corresponding dba_2pc entries

1.


delete from sys.pending_trans$ where local_tran_id = '44.88.85589';
delete from sys.pending_sessions$ where local_tran_id = '44.88.85589';
delete from sys.pending_sub_sessions$ where local_tran_id ='44.88.85589';
commit;

2. Now insert the dummy record as explained in section:

2.2 Distributed transaction without corresponding dba_2pc entries
commit;

3. Commit force '44.88.85589'

4. Purge the transaction:

exec dbms_transaction.purge_lost_db_entry('44.88.85589');

Note:126069.1 Manually Resolving In-Doubt Transactions: Different Scenario's



Still have questions ?


To discuss this information further with Oracle experts and industry peers, we encourage you to review, join or start a discussion via My Oracle Support Streams and Distributed Database Community



References

NOTE:100664.1- Master Note for Troubleshooting Oracle Managed Distributed Transactions

NOTE:126069.1- Manually Resolving In-Doubt Transactions: Different Scenarios


显示相关信息 相关内容


产品


  • Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition

关键字


DBA_2PC_NEIGHBORS; DBA_2PC_PENDING; DBMS_TRANSACTION; DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY; DISTRIBUTED; IN-DOUBT; PURGE; TRANSACTION

错误


ORA-2054; ORA-2058; ORA-1591; ORA-6512; ORA-1453; ORA-6510

返回页首返回页首

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/38267/viewspace-713103/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/38267/viewspace-713103/

How To Resolve Stranded DBA_2PC_PENDING Entries [ID 401302.1]相关推荐

  1. oracle txn,【学习笔记】ORACLE分布式事务故障的处理 结合MOS官方文档分析

    [学习笔记]ORACLE分布式事务故障的处理 结合MOS官方文档分析 时间:2016-10-25 10:59   来源:Oracle研究中心   作者:HTZ   点击: 次 天萃荷净 Oracle研 ...

  2. 关于dva的put,put.resolve

    关于dva的put,put.resolve ​ 由于项目使用的是dva.js,在项目重遇到一个场景是需要拿着特定的选中单据的taskId去获取单据真正的id,其中获取真正id的接口是需要轮询3次的,下 ...

  3. 【vue-router,使用router.resolve打开新页面路由跳转】

    vue-router,打开新页面路由跳转 方法 传参 let { href } = this.$router.resolve({path: '/path',query:{id: id ,year: y ...

  4. 以太坊 p2p Server 原理及实现

    以太坊p2p原理与实现 区块链技术的去中心依赖于底层组网技术,以太坊的底层实现了p2pServer,大约可以分为这样三层. 底层路由表.封装了kad路由,节点的数据结构以及计算记录,节点搜索,验证等功 ...

  5. aws dynamodb_如何使用AWS Lambda将DynamoDB集成到您的API中

    aws dynamodb by Sam Williams 通过山姆·威廉姆斯 如何使用AWS Lambda将DynamoDB集成到您的API中 (How to Integrate DynamoDB i ...

  6. vue2.x源码解析(一)

    简介 本文以vue2.x框架作为分析,简单记录整个源码编译的过程.https://zhuanlan.zhihu.com/p/552685329 源码目录 src ├── compiler # 编译相关 ...

  7. 见证奇迹-Vue源码全面揭秘

    Created By JishuBao on 2019-03-21 19:38:22 Recently revised in 2019-03-21 19:38:22 开篇题外话:   本文是根据某网的 ...

  8. 前端面试题-JavaScript篇

    web前端面试题 JavaScript篇 1.JavaScript的数据类型都有哪些(8条)? ES5中有6种:Number.String.Boolean.Undefined.Null.Object ...

  9. vite预构建源码梳理

    对于"为什么要进行依赖预构建?"这个问题vite 文档已经解释的很清楚了,那么预构建大概的流程是什么样的呢? 启动预构建 从文档中我们知道在服务启动前会进行预构建,对应源码位置在s ...

最新文章

  1. 微信第三方平台开发 - 常见问题汇总
  2. 超越快手腾讯!度小满NLP模型登顶CLUE榜首
  3. c语言统计输入文本不同字母单词数,【C语言统计不同单词个数编写一个程序,输入一个句子,然后统计-查字典问答网...
  4. 018-继承-OC笔记
  5. opencv将整个图片BGR通道的某个通道进行修改
  6. ora 00900 已编译但有错误_ora-01113:文件2 需要介质恢复
  7. web表单设计:点石成金_设计复杂的用户表单:12个UX最佳实践
  8. 微软.Net Core 3.0 预览版7发布:大幅减少 SDK 空间大小
  9. JavaScript的事件执行机制及异步
  10. BackTrack 4 R2安装VMware tools
  11. picGo图片上传到码云失败,报错404-{“message”:“Branch”}的解决方法
  12. H83601D直插DIP千兆双口网络接口隔离滤波脉冲变压器
  13. Aria2Gee 教程
  14. 结合实际案例讲解系统分析方法
  15. 无法查找网络工作组计算机,无法查看工作组计算机怎么解决
  16. Java随笔记录第五章:类设计基础
  17. 头发保护 - 二硫化硒洗剂
  18. 欧洲十大电动摩托车市场-Part one
  19. win10禁用快速启动装linux,win10如何关闭快速启动
  20. python代码中的中文语法错误:SyntaxError: Non-ASCII character ‘\xe5‘ in file trade.py on line 7

热门文章

  1. NEON技术粗浅认识
  2. 致敬贝叶斯以及自己对贝叶斯的一些见解
  3. 香港珠宝零售商将使用区块链平台追踪钻石
  4. Hydro李天放:为了区块链我曾拒绝了李开复
  5. 预备篇 I :范畴与函子
  6. 虚拟机设置共享文件夹
  7. 战地一怎么修改服务器,战地1怎么修改服务器地址
  8. FlexRay通信协议概述
  9. 自己解决在Vue中动态渲染图片不显示的问题
  10. Javascript 与 或 非 符号