ORACLE报ORA-02049错误怎么办
小编给大家分享一下ORACLE报ORA-02049错误怎么办,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
1.查询哪个用户致使死锁的产生:
select username,lockwait,status,machine,program from v$session where sid in
(select session_id from v$locked_object);
2.查看当前系统锁情况
SELECT /*+ rule */
lpad(' ', decode(l.xidusn, 0, 3, 0)) || l.oracle_username User_name,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#
FROM v$locked_object l, dba_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid
ORDER BY o.object_id, xidusn DESC;
查看被死锁的语句
select sql_text from v$sql where hash_value in
(select sql_hash_value from v$session where sid in (select session_id from v$locked_object));
3.查找被死锁的进程
SELECT s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#, l.ORACLE_USERNAME,
l.OS_USER_NAME,l.PROCESS FROM V$LOCKED_OBJECT l,V$SESSION S
WHERE l.SESSION_ID=S.SID;
4.解锁,将死锁进程kill掉
alter system kill session 'sid,serial#';
看完了这篇文章,相信你对"ORACLE报ORA-02049错误怎么办"有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!