解决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'

不见得能查出,碰运气了

相关推荐
汽车仪器仪表相关领域4 分钟前
光轴精准测量,安全照明保障——NHD-8101/8000型远近光检测仪项目实战分享
数据库·人工智能·安全·压力测试·可用性测试
大爱编程♡14 分钟前
Spring IoC&DI
数据库·mysql·spring
king_harry22 分钟前
金仓数据库KingbaseES中WalMiner接口使用
数据库·kingbase·walminer
爱潜水的小L26 分钟前
自学嵌入式day43,商城网页
数据库·oracle
IvorySQL32 分钟前
PostgreSQL 的 SQL 查询之旅
数据库·人工智能·postgresql·开源
musenh44 分钟前
redis和jedis
数据库·redis·缓存
莳花微语1 小时前
磐维数据库的权限使用
数据库
win x2 小时前
Redis 主从复制
java·数据库·redis
周末吃鱼2 小时前
MySQL CTE:SQL查询新模式
数据库·sql·mysql
木风小助理2 小时前
解读 SQL 累加计算:从传统方法到窗口函数
大数据·数据库·sql