解决Oracle死锁问题

增加人员信息即死锁,排查过程如下(表名字为A001):

1、根据表查询死锁进程ID

select b.owner,b.object_name,a.session_id,a.locked_mode

from v$locked_object a,dba_objects b

where b.object_id = a.object_id and object_name='A080'

其中locked_mode:

"1":Select。

"2":Select for update,Lock For Update,Lock Row Share

"3":Insert, Update, Delete, Lock Row Exclusive

"4":Create Index, Lock Share

locked_mode为2,3,4不影响DML(insert,delete,update,select)操作, 但DDL(alter,drop等)操作会提示ora-00054:"resource busy and acquire with NOWAIT specified"

"5"::Lock Share Row Exclusive

"6":Alter table, Drop table, Drop Index, Truncate table, Lock Exclusive

2、根据ID查询进程具体信息

select b.username,b.sid,b.serial#,logon_time

from v$session b

where sid='9'

这时可以杀进程

ALTER SYSTEM KILL SESSION '9,5' IMMEDIATE;

3、查死锁语句

SELECT s.sid, s.serial#, s.username, s.sql_id, s.sql_child_number, s.program, t.used_ublk

FROM vsession s, vtransaction t

WHERE s.saddr = t.ses_addr and sid='579'

不见得能查出,碰运气了

相关推荐
RestCloud12 小时前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud12 小时前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence14 小时前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
DemonAvenger21 小时前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥1 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
RestCloud2 天前
揭秘 CDC 技术:让数据库同步快人一步
数据库·api
得物技术2 天前
MySQL单表为何别超2000万行?揭秘B+树与16KB页的生死博弈|得物技术
数据库·后端·mysql
可涵不会debug2 天前
【IoTDB】时序数据库选型指南:工业大数据场景下的技术突围
数据库·时序数据库
ByteBlossom2 天前
MySQL 面试场景题之如何处理 BLOB 和CLOB 数据类型?
数据库·mysql·面试
麦兜*2 天前
MongoDB Atlas 云数据库实战:从零搭建全球多节点集群
java·数据库·spring boot·mongodb·spring·spring cloud