标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr MySQL恢复 obet ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-600 kcratr_nab_less_than_odr ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle碎片 OSD-04016 YOUR FILES ARE ENCRYPTED 比特币加密文章分类
- MongoDB (1)
- MongoDB恢复 (1)
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (112)
- 数据库 (1,882)
- DB2 (22)
- MySQL (82)
- Oracle (1,707)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (168)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (72)
- Oracle Bug (8)
- Oracle RAC (56)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (661)
- Oracle安装升级 (108)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (91)
- PostgreSQL (37)
- pdu工具 (7)
- PostgreSQL恢复 (13)
- SQL Server (34)
- SQL Server恢复 (14)
- TimesTen (7)
- 达梦数据库 (5)
- 达梦恢复 (3)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (51)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (34)
- MongoDB (1)
-
最近发表
- 断电引起ORA-600 3005故障处理
- 记录一次云存储资源到期之后引起的数据库恢复
- Firebird 损坏数据库数据抢救工具—firebirdext
- Oracle 19c 202610补丁(RUs+OJVM)-19.33
- 由于con$.con#值达到极限,触发数据库增加约束报ORA-600 12807错误
- MongoDB 离线提取工具—mongoext
- .bres勒索病毒加密数据库dmp文件可恢复
- ORA-600 krsm_mrp_rebuild_lf_list.lno_mismatch
- 记录一次0丢失的ORA-00354: 损坏重做日志块标头故障恢复
- 不当数据库恢复操作导致一个月数据丢失
- obet快速修复oracle 位图损坏块
- 不太常见的10.2.0.1的oracle redo损坏恢复
- obet forcecopy功能抢救硬件故障中的数据文件
- kcratr_nab_less_than_odr和system坏块故障处理
- 通过obet 恢复system坏块,打开数据库
- obet dbv功能完整说明
- 分享一例运行在aix上的sap系统数据库恢复过程
- OBET-Oracle Block Editor Tool使用说明
- 几乎动用了所有手段的Oracle故障恢复
- Oracle Block Edit Tool (obet) 功能增强–2026.07
标签归档:TX Enqueue contention
分析一例 TX Enqueue contention案例
应用反馈某个业务比较慢,需要紧急处理
查询等待事件
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
SQL> select A.INST_ID,count(*), event
2 from Gv$session_wait a
3 where event not in ('SQL*Net more data to client',
4 'rdbms ipc message',
5 'smon timer',
6 'pmon timer',
7 'SQL*Net message from client',
8 'lock manager wait for remote message',
9 'ges remote message',
10 'gcs remote message',
11 'gcs for action',
12 'client message',
13 'pipe get',
14 'null event',
15 'PX Idle Wait',
16 'single-task message',
17 'PX Deq: Execution Msg',
18 'KXFQ: kxfqdeq - normal deqeue',
19 'listen endpoint status',
20 'slave wait',
21 'wakeup time manager','jobq slave wait')
22 group by INST_ID,event
23 order by 1 desc,2 desc;
INST_ID COUNT(*) EVENT
---------- ---------- --------------------------------------
2 8 enqueue
2 1 async disk IO
2 1 db file sequential read
2 1 SQL*Net message to client
2 1 PX Deq: reap credit
1 2 global cache cr request
1 1 async disk IO
1 1 PX Deq: reap credit
1 1 PX Deq: Execute Reply
9 rows selected.
发现enqueue等待有些多,怀疑是TX enquenue,查询阻塞者
SQL> set linesize 100
SQL> set pagesize 66
SQL> col c1 for a15
SQL> col c1 heading "Program Name "
SQL> select l.inst_id,l.SID,program c1,l.TYPE,l.ID1,l.ID2,l.LMODE,l.REQUEST
2 from gv$lock l,gv$session s
3 where l.type like 'TX' and l.REQUEST =6
4 and l.inst_id=s.inst_id and l.sid=s.sid
5 order by id1
6 /
INST_ID SID Program Name TY ID1 ID2 LMODE REQUEST
---------- ---------- --------------- -- ---------- ---------- ---------- ----------
2 295 rtStopMain@zwq_ TX 1441805 2391806 0 6
bill_2 (TNS V1-
V3)
2 992 rtStopMain@zwq_ TX 1441805 2391806 0 6
bill_2 (TNS V1-
V3)
2 1238 rtStopMain@zwq_ TX 6946827 2546365 0 6
bill_2 (TNS V1-
V3)
2 1298 rtStopMain@zwq_ TX 6946827 2546365 0 6
bill_2 (TNS V1-
V3)
2 1684 rtStopMain@zwq_ TX 6946827 2546365 0 6
bill_2 (TNS V1-
V3)
2 1553 rtStopMain@zwq_ TX 6946827 2546365 0 6
bill_2 (TNS V1-
V3)
2 75 rtStopMain@zwq_ TX 12451856 199146 0 6
bill_2 (TNS V1-
V3)
2 1125 rtStopMain@zwq_ TX 14352404 63837 0 6
bill_2 (TNS V1-
V3)
查询持有者
SQL> set linesize 100
SQL> set pagesize 66
SQL> col c1 for a15
SQL> col c1 heading "Program Name "
SQL> select l.inst_id,l.SID,program c1,l.TYPE,l.ID1,l.ID2,l.LMODE,l.REQUEST
2 from gv$lock l,gv$session s
3 where l.type like 'TX' and l.LMODE =6 and (l.ID1,l.ID2) in
4 (select id1,id2 from gv$lock where type like 'TX' and REQUEST =6)
5 and l.inst_id=s.inst_id and l.sid=s.sid
6 order by id1
7 /
INST_ID SID Program Name TY ID1 ID2 LMODE REQUEST
---------- ---------- --------------- -- ---------- ---------- ---------- ----------
2 75 rtStopMain@zwq_ TX 1441805 2391806 6 0
bill_2 (TNS V1-
V3)
2 992 rtStopMain@zwq_ TX 6946827 2546365 6 0
bill_2 (TNS V1-
V3)
2 295 rtStopMain@zwq_ TX 12451856 199146 6 0
bill_2 (TNS V1-
V3)
2 1553 rtStopMain@zwq_ TX 14352404 63837 6 0
bill_2 (TNS V1-
V3)
通过持有者和阻塞者可以得出:
1.持有者和阻塞者都是在2号实例上
2.持有者75阻塞了295/992的会话
3.持有者992阻塞了1238/1298/1684/1553的会话
4.持有者295阻塞了75的会话
5.持有者1553阻塞了1125的会话
6.同时分析发现,所有的持有者sid也在阻塞者中,也就是持有者阻塞了某个sid,而自身又被其他sid给阻塞,形成了多级阻塞或者环.如:75阻塞了295,而295有阻塞了75;992阻塞了1553,而1553阻塞了1125
查询阻塞和持有者对象
SQL> set linesize 110
SQL> col c0 for 999
SQL> col c0 heading "INS"
SQL> col c1 for a15
SQL> col c1 heading "Program Name "
SQL> select inst_id c0,sid,program c1,ROW_WAIT_OBJ# object_no, ROW_WAIT_FILE# Rfile_no,
2 ROW_WAIT_BLOCK# Block_no ,ROW_WAIT_ROW# Row_no
3 from gv$session
4 where (inst_id,sid) in (select inst_id,sid from gv$session_wait where p1='1415053318')
5 /
INS SID Program Name OBJECT_NO RFILE_NO BLOCK_NO ROW_NO
---- ---------- --------------- ---------- ---------- ---------- ----------
2 75 rtStopMain@zwq_ 1323132 13 122601 111
bill_2 (TNS V1-
V3)
2 295 rtStopMain@zwq_ 1323132 13 122601 100
bill_2 (TNS V1-
V3)
2 992 rtStopMain@zwq_ 1323132 13 122601 101
bill_2 (TNS V1-
V3)
2 1125 rtStopMain@zwq_ 1323132 84 38445 70
bill_2 (TNS V1-
V3)
2 1238 rtStopMain@zwq_ 1323132 15 255066 41
bill_2 (TNS V1-
V3)
2 1298 rtStopMain@zwq_ 1323132 14 118411 8
bill_2 (TNS V1-
V3)
2 1553 rtStopMain@zwq_ 1323132 15 255066 19
bill_2 (TNS V1-
V3)
2 1684 rtStopMain@zwq_ 1323132 14 118411 21
bill_2 (TNS V1-
V3)
8 rows selected.
SQL> set linesize 100
SQL> set pagesize 100
SQL> col owner for a10
SQL> col object_name for a20
SQL> col object_type for a10
SQL> select owner,object_name,object_id,object_type
2 from dba_objects
3 where
4 object_id in (select ROW_WAIT_OBJ# from gv$session
5 where (inst_id, sid) in (select inst_id,sid from gv$session_wait where p1='1415053318'))
6 /
OWNER OBJECT_NAME OBJECT_ID OBJECT_TYP
---------- -------------------- ---------- ----------
DBACCADM DCUSTCREDITBALANCE 1323132 TABLE
通过查询的出来,所有操作的聚焦点都是在DBACCADM.DCUSTCREDITBALANCE表上面
查询相关sql语句
SQL> SQL> set linesize 120
SQL> set pagesize 66
SQL> col c0 for 999
SQL> col c0 heading "INS"
SQL> col c1 for a9
SQL> col c1 heading "OS User"
SQL> col c2 for a9
SQL> col c2 heading "Oracle User"
SQL> col c3 for a15
SQL> col c3 heading "Program Name"
SQL> col b1 for a9
SQL> col b1 heading "Unix PID"
SQL> col b2 for 9999 justify left
SQL> col b2 heading "ORA SID"
SQL> col b3 for 999999 justify left
SQL> col b3 heading "SERIAL#"
SQL> col sql_text for a45
SQL> set space 1
SQL> break on b1 nodup on c0 nodup on c3 nodup on c1 nodup on c2 nodup on b2 nodup on b3 skip 2
SQL> select a.inst_id c0,b.sid b2,c.spid b1, b.program c3, b.username c2,b.serial# b3, a.sql_text
2 from gv$sql a, gv$session b, gv$process c
3 where
4 a.address = b.sql_address
5 and b.paddr = c.addr
6 and a.hash_value = b.sql_hash_value
7 and a.inst_id=b.inst_id and a.inst_id=c.inst_id
8 and a.inst_id like '&inst_id' and b.sid like '&sid'
9 order by c.spid,a.hash_value
10 /
Enter value for inst_id: 2
Enter value for sid: 75
old 8: and a.inst_id like '&inst_id' and b.sid like '&sid'
new 8: and a.inst_id like '2' and b.sid like '75'
INS ORA SID Unix PID Program Name Oracle Us SERIAL# SQL_TEXT
---- ------- --------- --------------- --------- ------- ---------------------------------------------
2 75 1167392 rtStopMain@zwq_ DBCUSTOPR 42815 update dcustcreditbalance set limit_owe=:b0,
bill_2 (TNS V1- unbill_fee=:b1,prepay_fee=:b2,owe_fee=:b3,op_
V3) time=sysdate where id_no=:b4
SQL> /
Enter value for inst_id: 2
Enter value for sid: 992
old 8: and a.inst_id like '&inst_id' and b.sid like '&sid'
new 8: and a.inst_id like '2' and b.sid like '992'
INS ORA SID Unix PID Program Name Oracle Us SERIAL# SQL_TEXT
---- ------- --------- --------------- --------- ------- ---------------------------------------------
2 992 2760870 rtStopMain@zwq_ DBCUSTOPR 56282 update dcustcreditbalance set limit_owe=:b0,
bill_2 (TNS V1- unbill_fee=:b1,prepay_fee=:b2,owe_fee=:b3,op_
V3) time=sysdate where id_no=:b4
SQL> /
Enter value for inst_id: 2
Enter value for sid: 295
old 8: and a.inst_id like '&inst_id' and b.sid like '&sid'
new 8: and a.inst_id like '2' and b.sid like '295'
INS ORA SID Unix PID Program Name Oracle Us SERIAL# SQL_TEXT
---- ------- --------- --------------- --------- ------- ---------------------------------------------
2 295 1639008 rtStopMain@zwq_ DBCUSTOPR 35740 update dcustcreditbalance set limit_owe=:b0,
bill_2 (TNS V1- unbill_fee=:b1,prepay_fee=:b2,owe_fee=:b3,op_
V3) time=sysdate where id_no=:b4
其他阻塞者和持有者执行sql语句均和该语句相同,省略其他查询.通过这些查询可以确定是因为对dcustcreditbalance表的更新操作导致了这样的现象发生.
处理方案
1.临时处理方案:kill掉持有者
2.永久处理方案:修改这部分程序业务逻辑

加我微信(17813235971)
加我QQ(107644445)

