ORA-01591故障处理

ORA-01591: lock held by in-doubt distributed transaction 20.25.280352 ORA-01591: lock held by in-doubt distributed transaction,oracle分布式事务2阶段提交问题 阅读详情

早晨到办公室听同事说表被锁了,一试,发现表中某字段为1111111的行都被锁了,SELECT都不行。报错误ORA-01591,打开TOAD的Knowledge eXpert,描述很少,只是说由于分布式事务错误而造成锁定。询问同事,昨天通过一个存储过程调用另一个存储过程出了错误,而后者通过透明网关insert一些数据到SQl Server数据库。
立即想到打开OEM,谁知道大失所望,进入锁,根本没发现相关的对象被锁定,开始有点郁闷。转而检查会话,该用户有5个会话,都是INACTIVE,不管三七二十一,全部杀掉。结果依旧,并且锁也没有出现。远程登陆上主机,发现CPU和进程都正常,也没有发现透明网关进程挂死(之前曾发现TG4SQL在无业务量时也会出现25%左右的CPU,挂死)。
突然想到看看alert.log,经过仔细搜索,终于发现:

Wed Nov 17 00:00:04 2004
Errors in file d:/oracle/admin/xdcj/udump/xdcj_j006_3020.trc:
ORA-12012: 自动执行作业 82 出错
ORA-01591: 锁定已被有问题的分配事务处理6.5.887985挂起
ORA-06512: 在line 6

这正是出错的地方,往前追溯:

Tue Nov 16 17:35:04 2004
Error 28500 trapped in 2PC on transaction 6.5.887985. Cleaning up.
Error stack returned to user:
ORA-02054: 事务处理6.5.887985有问题
ORA-28500: 连接 ORACLE 到非 Oracle 系统时返回此信息:
[Transparent gateway for MSSQL]
ORA-02063: 紧接着2 lines(源于ZSMOS_CRM)
Tue Nov 16 17:35:04 2004
DISTRIB TRAN QDCJ.US.ORACLE.COM.5ae32328.6.5.887985
  is local tran 6.5.887985 (hex=06.05.d8cb1)
  insert pending prepared tran, scn=6606197672830 (hex=602.2010cb7e)
Tue Nov 16 17:35:07 2004
Errors in file d:/oracle/admin/xdcj/bdump/xdcj_reco_3024.trc:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Transparent gateway for MSSQL][Microsoft][ODBC SQL Server Driver][SQL Server]用户 'RECOVER' 登录失败。 (SQL State: 28000; SQL Code: 18456)
ORA-02063: preceding 2 lines from ZSMOS_CRM

Tue Nov 16 17:35:12 2004
Errors in file d:/oracle/admin/xdcj/bdump/xdcj_reco_3024.trc:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Transparent gateway for MSSQL][Microsoft][ODBC SQL Server Driver][SQL Server]用户 'RECOVER' 登录失败。 (SQL State: 28000; SQL Code: 18456)
ORA-02063: preceding 2 lines from ZSMOS_CRM

这就是事发地点了。看来是昨天下午远程事务失败,但是又没有返回造成分布式事务挂死,从而锁定了行。终于找到了详细的错误ORA-02054,进入TOAD一查,说是要等待或者提交该事务,可是怎么操作呢。还是打开官方文档搜索相关内容,在Adminstrator Guide中发现如下内容:
Discovering Problems with a Two-Phase Commit
The user application that commits a distributed transaction is informed of a problem by one of the following error messages:

ORA-02050: transaction ID rolled back,
           some remote dbs may be in-doubt
ORA-02051: transaction ID committed,
           some remote dbs may be in-doubt
ORA-02054: transaction ID in-doubt


A robust application should save information about a transaction if it receives any of the above errors. This information can be used later if manual distributed transaction recovery is desired.

No action is required by the administrator of any node that has one or more in-doubt distributed transactions due to a network or system failure. The automatic recovery features of Oracle transparently complete any in-doubt transaction so that the same outcome occurs on all nodes of a session tree (that is, all commit or all roll back) after the network or system failure is resolved.

In extended outages, however, you can force the commit or rollback of a transaction to release any locked data. Applications must account for such possibilities.

Determining Whether to Perform a Manual Override
Override a specific in-doubt transaction manually only when one of the following situations exists:

The in-doubt transaction locks data that is required by other transactions. This situation occurs when the ORA-01591 error message interferes with user transactions.
An in-doubt transaction prevents the extents of a rollback segment from being used by other transactions. The first portion of an in-doubt distributed transaction's local transaction ID corresponds to the ID of the rollback segment, as listed by the data dictionary views DBA_2PC_PENDING and DBA_ROLLBACK_SEGS.
The failure preventing the two-phase commit phases to complete cannot be corrected in an acceptable time period. Examples of such cases include a telecommunication network that has been damaged or a damaged database that requires a long recovery time.
Normally, you should make a decision to locally force an in-doubt distributed transaction in consultation with administrators at other locations. A wrong decision can lead to database inconsistencies that can be difficult to trace and that you must manually correct.

If the conditions above do not apply, always allow the automatic recovery features of Oracle to complete the transaction. If any of the above criteria are met, however, consider a local override of the in-doubt transaction.

看来是建议差不多,后面Oracle总是试图登录SQl Server就是要自动恢复,可是总不成功。察看视图DBA_2PC_PENDING确实发现了该事务的痕迹。要怎样操作呢?

Manually Committing an In-Doubt Transaction
Before attempting to commit the transaction, ensure that you have the proper privileges. Note the following requirements:

If the transaction was committed by... Then you must have this privilege...
You
 FORCE TRANSACTION
 
Another user
 FORCE ANY TRANSACTION
 

Committing Using Only the Transaction ID
The following SQL statement commits an in-doubt transaction:

COMMIT FORCE 'transaction_id';


The variable transaction_id is the identifier of the transaction as specified in either the LOCAL_TRAN_ID or GLOBAL_TRAN_ID columns of the DBA_2PC_PENDING data dictionary view.

For example, assume that you query DBA_2PC_PENDING and determine that LOCAL_TRAN_ID for a distributed transaction is 1:45.13.

You then issue the following SQL statement to force the commit of this in-doubt transaction:

COMMIT FORCE '1.45.13';

Committing Using an SCN
Optionally, you can specify the SCN for the transaction when forcing a transaction to commit. This feature allows you to commit an in-doubt transaction with the SCN assigned when it was committed at other nodes.

Consequently, you maintain the synchronized commit time of the distributed transaction even if there is a failure. Specify an SCN only when you can determine the SCN of the same transaction already committed at another node.

For example, assume you want to manually commit a transaction with the following global transaction ID:

SALES.ACME.COM.55d1c563.1.93.29

First, query the DBA_2PC_PENDING view of a remote database also involved with the transaction in question. Note the SCN used for the commit of the transaction at that node. Specify the SCN when committing the transaction at the local node. For example, if the SCN is 829381993, issue:

COMMIT FORCE 'SALES.ACME.COM.55d1c563.1.93.29', 829381993;

See Also:
Oracle9i SQL Reference for more information about using the COMMIT statement
 

Manually Rolling Back an In-Doubt Transaction
Before attempting to roll back the in-doubt distributed transaction, ensure that you have the proper privileges. Note the following requirements:

If the transaction was committed by... Then you must have this privilege...
You
 FORCE TRANSACTION
 
Another user
 FORCE ANY TRANSACTION
 

The following SQL statement rolls back an in-doubt transaction:

ROLLBACK FORCE 'transaction_id';


The variable transaction_id is the identifier of the transaction as specified in either the LOCAL_TRAN_ID or GLOBAL_TRAN_ID columns of the DBA_2PC_PENDING data dictionary view.

For example, to roll back the in-doubt transaction with the local transaction ID of 2.9.4, use the following statement:

ROLLBACK FORCE '2.9.4';

于是登陆数据库
COMMIT FORCE '6.5.887985';
然后查看DBA_2PC_PENDING发现状态已经改为'COMMIT FORCE',SELECT该表相关行,一切正常。至此,故障解决。
总体来看,直接INSERT ... TABLENAME@SQLDBLK还是很危险的,遇上不能正常返回就出问题了。Oracle的文档是推荐使用包或者存储过程来解决,此后建议同事改用此方法,目前已经测试通过。

RedPitaya火龙果板基础操作 火龙果板基础操作一级目录二级目录三级目录 一级目录 二级目录 三级目录 阅读详情

相关推荐

Couldn‘t find device with uuid 恢复LVM元数据 linux

Couldn't find device with uuid 恢复LVM元数据 linux欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 欢迎使用Markdown编辑器 你好! 这是你第一次使

m0_57559579的博客 7173

ORA-01591:锁被未决分布式事务处理xx.xx.xxxxxx持有【解决方法】

ORA-01591错误一般是由于分布式事务造成的,造成分布式事务失败的原因主要是库之间的网络突然异常,造成两个库中的事务信息不一致,所以会有残余的分布式事务信息。对于绝大多数情况,当恢复连接或CRASH的数据库重新启动后,会自动解决分布式事务,不需要人工干预。当特殊情况,网络异常,触发特殊数据库BUG时,未成自动recovery事务时,才使用人工操作的方式来维护分布式事务。建议1)保持dblink数据库之间的网络稳定2)同时减少使用dblink进行跨库事务处理。

weixin_42329915的博客 2418

c语言【分糖果】2023蓝桥杯4124(枚举,递归,dfs)

但是这是不符合我们糖果刚好分完的条件的,我们应该往回退到上一层,也就是孩子6这层,然后j+1=3,孩子7分到3个第二种糖果,这也不符合我们糖果刚好分完的条件,然后就会再次回退到孩子6这里,然后j+1=4,让我们的孩子7获得5块第二种糖果,然后还是不符合糖果刚分完的条件,于是再一次退回到孩子6这里,然后就会有外循环i+1=1,j=1,孩子7分到1块第一种糖果1块第二块糖果......然后就是这样的不停地回溯,试探,直到把整棵树遍历一遍,并且记录所有的满足条件的组合。先放一下我的代码,我的代码超时啦救命!

weixin_74331419的博客 736

oracle ORA-01591锁被未决分布式事务处理

此种情况就是在本地执行commit以后,此时远端库还没有完全commit,此时网络中断,导致本地库该表是commit状态,但是远端库还是prepare状态,一般来讲,此时如果源端得到的事务信息是全的,那么数据库不需要人为干预,能够自动根据事务信息进行提交操作,但是出现这个问题的时候,基本就表示提交的事务信息不足以让远端库执行提交操作,所以此时这种事务就需要人为干预了。– 可根据异步transaction的状况决定使用方法。这种情况,commit force还是rollback force都会报。

汪灵骅的博客 2870

潜在图神经网络学习笔记(Latent Graph Neural Networks for Human Skeleton-based Action Recognition)

在本文中,我们从一个新的角度来解决这个问题,通过将非结构化的骨架数据映射到潜在空间,如图2所示,这里称为潜在特征空间或嵌入空间,其中一组项嵌入在一个流形中[ 1 ],并且在潜在空间中彼此更相似的项被放置在彼此更接近的位置。潜在空间中的位置可以被认为是由一组潜在变量定义的,这些潜在变量来源于对象的相似性。将骨架数据嵌入到流形中,消除了远近邻居之间的冗余依赖关系,以解决加权问题。得到具有多尺度聚合特征的稀疏图矩阵结构,以更好地理解骨骼关节的直接加权信息。

qq_45631885的博客 496

vCenter Server出现no healthy upstream的解决方法

可以通过"VMware vCenter Server Management(服务)"来排查问题,在网页里面找到“服务”模块,会发现有很多服务没有启动起来,而且手动启动也无法启动。7.0 地址后,页面出现“no healthy upstream”,无法正常登录vCenter,重启后依旧如此,该故障的前提是没有对vCenter做过任何配置,如下图所示。于是用命令查询是否有证书过期,发现真有多个服务依赖的证书在当天早上过期。使用如下命令尝试打开服务发现不分服务可以打开,不分服务无法打开。

1万+

使用FORALL + BULK COLLECT来批量插入优化大事务

开发人员找到我说,报表系统中有一个存储过程最近总是报错ORA-02050:transaction .. . rolled back,some remote DBs may be in-doubt。 根据错误信息可知,可能是由于远程数据库处理失败,导致事务失败而回滚。原因可能是网络不稳定,也可能是remote节点的连接超时,也有可能被kill了等。 系统室负责人说了,公司的网络绝对没问题,报错肯定...

mqcLuck 1193

手把手教你用家用电脑完成图片和视频AI去水印功能

图片视频 AI去水印

cs821984831的博客 3995

ORA-01591: 锁被未决分布式事务处理解决方案

这个错误是什么意思呢?

m0_38048955的博客 1903

【无人机编队】基于matlab虚拟leader无人机编队仿真【含Matlab源码 3279期】

虚拟leader无人机编队仿真 完整代码,包运行;可提供运行操作视频!适合小白!

订阅付费专栏Matlab(奶茶价版),可赠送奶茶价版付费专栏指定代码1份; 843

芯片ATE测试PAT(Part Average Testing)学习总结-20250916

文章摘要:零件平均测试(PAT)是半导体制造中基于统计学的质量控制方法,分为静态和动态两种类型。静态PAT通过预先设定的固定限值(每6-8批次更新)筛选异常芯片,计算采用稳健平均值和四分位间距。动态PAT则根据实时数据调整限值,能更精确识别异常而不误判合格芯片。两种方法均采用"均值±6倍标准差"的计算公式,但动态PAT具有更好的适应性和准确性。该方法通过统计分析提高了芯片产品的质量和可靠性。

歌颂苦难的行为是无耻的; 1203

ORA-01591故障处理(转)

ORA-01591故障处理,sql,sql教程,Oracle基础早晨到办公室听同事说表被锁了,一试,发现表中某字段为1111111的行都被锁了,SELECT都不行。报错误ORA-01591,打开TOAD的Knowledge eX...

cuankuangzhong6373的博客 410

巡检类机器人电池容量计算方法论(原理+算法+真实案例)

摘要:本文系统阐述了巡检机器人电池容量的计算方法,重点解析了;能量平衡;核心原理和三种主流算法。通过光伏电站履带式巡检机器人的真实案例,详细演示了从工况拆解、功耗采集到容量计算的完整流程。文章指出:室内轻载场景可采用静态平均功耗法,户外常规工况推荐动态负载积分法,而复杂环境需采用融合估算算法。特别强调需考虑温度修正(冬季容量衰减20%)、冗余系数(1.2-1.5)和放电深度(磷酸铁锂DoD取80%)等关键参数。

start_up_go的博客 246

转载ORA-01591错误故障处理

ORA-01591错误故障处理 摘要: 在访问某些表的特定行时报ORA-01591错误 select * from BF_INCOME_EXPENSES_T where account_id = 36816153...

cohot68660的专栏 178

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

ORA-01591错误故障处理(一)

http://blueocean926.itpub.net/post/38439/477038 ORA-01591错误故障处理 摘要: 在访问某些表的特定行时报ORA-01591错误 select * from BF...

congyun2180的博客 414

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

c 取oracle 错误代码,转载ORA-01591错误故障处理

ORA-01591错误故障处理摘要:在访问某些表的特定行时报ORA-01591错误select* from BF_INCOME_EXPENSES_Twhereaccount_id = 36816153anduser_id = 39964213andcity_code = '185'ORA-01591:锁定已被有问题的分配事务处理72.0.1608712挂起SQL>select count(*...

weixin_39981360的博客 249

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

【故障处理】分布式事务ORA-01591错误解决

【故障处理】分布式事务ORA-01591错误解决 1BLOG文档结构图 ...

啊啊啊啊2 201

ORA-01591错误故障处理(三)

http://blueocean926.itpub.net/post/38439/477038 SQL> select * from dba_2pc_pending; LOCAL_TRAN_ID GLOBAL_TR...

congyun2180的博客 206

ORA-01591错误故障处理(二)

http://blueocean926.itpub.net/post/38439/477038 故障处理 SQL> alter system disable distributed recovery; 系统已...

congyun2180的博客 193

oracle 未决的分布式,ORA-01591 锁被未决分布式事务处理持有

ORA-01591:锁被未决分布式事务处理11.30.97238持有01591.00000-"lockheldbyin-doubtdistributedtransaction%s"*Cause:Tryingtoaccessresourcethatislockedbyadeadtwo-phasecommittransactionthatisin...

weixin_42298382的博客 1976

oracle sql 不能输入 光标自动跳到本行末尾 insert,ORA-01591故障处理-数据库专栏,ORACLE...

早晨到办公室听同事说表被锁了,一试,发现表中某字段为1111111的行都被锁了,select都不行。报错误ora-01591,打开toad的knowledge expert,描述很少,只是说由于分布式事务错误而造成锁定。询问同事,昨天通过一个存储过程调用另一个存储过程出了错误,而后者通过透明网关insert一些数据到sql server数据库。立即想到打开oem,谁知道大失所望,进入锁,根本没发现...

weixin_32048757的博客 319

分布式事务ORA-01591错误解决

原文出处:http://www.cnblogs.com/lhrbest/archive/2016/08/04/5738544.html【故障处理】分布式事务ORA-01591错误解决1 BLOG文档结构图2 前言部分2.1 导读和注意事项各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:① 分布式事务的简单概...

weixin_33928137的博客 215
上一篇: GAIM
下一篇: 路在何方
ern
ern
博客等级 码龄24年 25粉丝 115原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址