【ORA-02049】超时分布式事务处理等待锁 解决方法 推荐

转:http://blog.itpub.net/15592508/viewspace-765344/

(1)以sys用户登陆数据库查询死锁:

SQL> select username,lockwait,status,machine,program from v$session where sid in (select session_id from v$locked_object);

 

(2)然后使用一下语句查找被死锁的语句

SQL> 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)再使用以下语句查找被死锁的进程

SQL> 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)根据步骤(3)查到的sid、serial#,使用以下语句把死锁的进程kill

SQL>alter system kill session ‘sid,serial#’; (其中sid=l.session_id)

 

你可能感兴趣的:(分布式事务)