ora-02049解決一例
執行儲存過程更新一個表中的資料的時候產生如下的錯誤:
SQL> exec update_jc_kxx_yxrq;
begin update_jc_kxx_yxrq; end;
ORA-20998: Err=-2049,Msg=0-ORA-02049: 超時: 分散式事務處理等待鎖定
ORA-06512: 在"ICUSER.UPDATE_JC_KXX_YXRQ", line 36
ORA-06512: 在line 2
以sys使用者登陸資料庫查詢死鎖
SQL> select username,lockwait,status,machine,program from v$session where sid in
2 (select session_id from v$locked_object);
USERNAME LOCKWAIT STATUS
------------------------------ ---------------- --------
MACHINE
----------------------------------------------------------------
PROGRAM
------------------------------------------------
ICUSER 000000038A37B7A8 ACTIVE
icdb
JDBC Thin Client
ICUSER 000000038A37C040 ACTIVE
icdb
JDBC Thin Client
USERNAME LOCKWAIT STATUS
------------------------------ ---------------- --------
MACHINE
----------------------------------------------------------------
PROGRAM
------------------------------------------------
ICUSER 000000038A37BF30 ACTIVE
icdb
JDBC Thin Client
ICUSER INACTIVE
icdb
USERNAME LOCKWAIT STATUS
------------------------------ ---------------- --------
MACHINE
----------------------------------------------------------------
PROGRAM
------------------------------------------------
JDBC Thin Client
ICUSER 000000038A37C150 ACTIVE
WorkGroupNameIC
collect.exe
ICUSER 000000038A37BFB8 ACTIVE
USERNAME LOCKWAIT STATUS
------------------------------ ---------------- --------
MACHINE
----------------------------------------------------------------
PROGRAM
------------------------------------------------
icdb
JDBC Thin Client
ICUSER 000000038A37C0C8 ACTIVE
icdb
JDBC Thin Client
說明資料庫有死鎖
然後使用一下語句查詢被死鎖的語句
SQL> select sql_text from v$sql where hash_value in
2 (select sql_hash_value from v$session where sid in
3 (select session_id from v$locked_object));
SQL_TEXT
--------------------------------------------------------------------------------
update JC_KXX SET LJXF =NVL ( LJXF , 0 ) + :1 , YE =:2 WHERE KH =:3
update jc_kxx set zt='07' where kh='1000530330'
再使用以下語句查詢被死鎖的程式
SQL> SELECT s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#,
2 l.ORACLE_USERNAME,l.OS_USER_NAME,l.PROCESS
3 FROM V$LOCKED_OBJECT l,V$SESSION S WHERE l.SESSION_ID=S.SID;
USERNAME OBJECT_ID SESSION_ID SERIAL#
------------------------------ ---------- ---------- ----------
ORACLE_USERNAME OS_USER_NAME PROCESS
------------------------------ ------------------------------ ------------
ICUSER 30523 32 42463
ICUSER oracle
ICUSER 30523 28 25508
ICUSER oracle
ICUSER 30523 76 14781
ICUSER oracle
USERNAME OBJECT_ID SESSION_ID SERIAL#
------------------------------ ---------- ---------- ----------
ORACLE_USERNAME OS_USER_NAME PROCESS
------------------------------ ------------------------------ ------------
ICUSER 30523 88 3943
ICUSER oracle
ICUSER 30523 46 17889
ICUSER oracle
ICUSER 30582 46 17889
ICUSER oracle
USERNAME OBJECT_ID SESSION_ID SERIAL#
------------------------------ ---------- ---------- ----------
ORACLE_USERNAME OS_USER_NAME PROCESS
------------------------------ ------------------------------ ------------
ICUSER 30603 46 17889
ICUSER oracle
ICUSER 30592 46 17889
ICUSER oracle
ICUSER 30588 46 17889
ICUSER oracle
USERNAME OBJECT_ID SESSION_ID SERIAL#
------------------------------ ---------- ---------- ----------
ORACLE_USERNAME OS_USER_NAME PROCESS
------------------------------ ------------------------------ ------------
ICUSER 30659 62 34578
ICUSER Administrator 1056:1020
ICUSER 30523 62 34578
ICUSER Administrator 1056:1020
ICUSER 30669 62 34578
ICUSER Administrator 1056:1020
USERNAME OBJECT_ID SESSION_ID SERIAL#
------------------------------ ---------- ---------- ----------
ORACLE_USERNAME OS_USER_NAME PROCESS
------------------------------ ------------------------------ ------------
ICUSER 30523 24 37522
ICUSER oracle
使用一下語句把死鎖的程式kill
alter system kill session ‘sid,serial#’; (其中sid=l.session_id)
如:SQL> alter system kill session '24,37522';
再次執行儲存過程,錯誤沒有了。語句執行成功!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/570433/viewspace-1010506/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Rownum分頁故障解決一例
- oracle 死鎖解決方法一例Oracle
- ORA-00959 解決一例
- 解決mysql innodb page corrupt一例MySql
- DRM引起的問題解決一例
- ora-600一例的解決方法
- sqlplus hang 解決方法一例SQL
- ora-1105 解決一例
- ORA-03232故障解決一例
- ORA-01652解決一例
- ora600 4194解決一例
- ORA-27301解決一例
- 【ORA-02049】超時分散式事務處理等待鎖 解決方法 推薦分散式
- keepalived啟動報錯解決一例
- VMWARE WORKSATTION 中 “the device is curreently in use” 解決一例dev
- Oracle DRM引起的問題解決一例Oracle
- [Oracle]--Library cache lock 故障解決一例Oracle
- mysql 匯入中文亂碼解決一例MySql
- 使用errorstack解決ORA-00904一例Error
- 行遷移檢測及解決一例
- solaris單使用者解決故障一例
- MySQL主從複製問題解決一例MySql
- composer包依賴衝突解決一例
- 解決一例latch:cache buffers chains小記AI
- ORA-00904故障分析與解決一例
- GoldenGate Extract程式hang問題解決一例Go
- ORA-03113錯誤解決一例
- RMAN-06133 錯誤解決一例
- 表格不能垂直居中問題解決一例 (轉)
- MySQL 5.6 GTID常見錯誤解決一例MySql
- Processes引數設定引起的故障解決一例
- ORA-02063錯誤解決一例
- ORA-12514: 錯誤解決一例
- yum方式安裝Percona XtraBackup報錯解決一例
- client backup was not attempted because backup window closed 錯誤解決一例client
- cisco4506 cpu佔用達99%解決一例
- oracle dbca報Exception in thread main 問題解決一例OracleExceptionthreadAI
- ASH記憶體強制Flush日誌解決一例記憶體