v$session之小測試(一)_與v$lock
本次測試目的為:根據v$session找到產生持鎖會話,視具體情況,kill掉持鎖會話,解決死鎖問題,並初步理解v$session各列的概念
SQL> select distinct sid from v$mystat; --確認一個會話的sid
SID
----------
988
----------
988
SQL> update t1 set a=1; --更新一個記錄不提交,會產生一個lock
已更新 1 行。
SQL> select distinct sid from v$mystat;--確認另一個會話的sid
SID
----------
976
----------
976
SQL> update t1 set a=2; --更新前一個會話的同一個表的資料,這樣會產生死鎖
select
sid,
serial#,
username,
command,--會話正在執行的命令,這裡是數字,詳細請查閱官方手冊
taddr,--事務狀態物件的地址,不是事務的地址,兩個概念
lockwait,--會話等待鎖的地址(是這個會話要等待的鎖的地址,對應v$lock的kaddr)
status,--會話各種狀態,有active,inactive,unknown其它
server,--專用或共享伺服器模式
schemaname,--會話所有使用者名稱稱
osuser,--客戶端(連線的應用)所在作業系統使用者名稱稱
blocking_session --阻塞這個會話的會話sid,非常有用,直接根據它去找持鎖會話
from v$session
SID SERIAL# USERNAME COMMAND TADDR LOCKWAIT STATUS SERVER SCHEMANAME OSUSER BLOCKING_SESSION
----- ---------- ---------- ---------- -------- -------- -------- --------- ------------------------------ ------------------------------ ----------------
968 75 PD 3 INACTIVE DEDICATED PD BvwW
975 301 SYS 3 ACTIVE DEDICATED SYS oracle
976 416 PD 6 3CC341C0 3DC347AC ACTIVE DEDICATED PD oracle 988
985 3 0 ACTIVE DEDICATED SYS oracle
986 3 0 ACTIVE DEDICATED SYS oracle
988 154 PD 0 3CC346E4 INACTIVE DEDICATED PD oracle
990 1 0 ACTIVE DEDICATED SYS oracle
991 1 0 ACTIVE DEDICATED SYS oracle
992 1 0 ACTIVE DEDICATED SYS oracle
993 1 0 ACTIVE DEDICATED SYS oracle
994 1 0 ACTIVE DEDICATED SYS oracle
995 1 0 ACTIVE DEDICATED SYS oracle
996 1 0 ACTIVE DEDICATED SYS oracle
997 1 0 ACTIVE DEDICATED SYS oracle
998 1 0 ACTIVE DEDICATED SYS oracle
999 1 0 ACTIVE DEDICATED SYS oracle
1000 1 0 ACTIVE DEDICATED SYS oracle
----- ---------- ---------- ---------- -------- -------- -------- --------- ------------------------------ ------------------------------ ----------------
968 75 PD 3 INACTIVE DEDICATED PD BvwW
975 301 SYS 3 ACTIVE DEDICATED SYS oracle
976 416 PD 6 3CC341C0 3DC347AC ACTIVE DEDICATED PD oracle 988
985 3 0 ACTIVE DEDICATED SYS oracle
986 3 0 ACTIVE DEDICATED SYS oracle
988 154 PD 0 3CC346E4 INACTIVE DEDICATED PD oracle
990 1 0 ACTIVE DEDICATED SYS oracle
991 1 0 ACTIVE DEDICATED SYS oracle
992 1 0 ACTIVE DEDICATED SYS oracle
993 1 0 ACTIVE DEDICATED SYS oracle
994 1 0 ACTIVE DEDICATED SYS oracle
995 1 0 ACTIVE DEDICATED SYS oracle
996 1 0 ACTIVE DEDICATED SYS oracle
997 1 0 ACTIVE DEDICATED SYS oracle
998 1 0 ACTIVE DEDICATED SYS oracle
999 1 0 ACTIVE DEDICATED SYS oracle
1000 1 0 ACTIVE DEDICATED SYS oracle
SQL> select * from v$lock order by sid;--檢視目前以上兩個持鎖及等待鎖會話的lock資訊
ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
-------- -------- ----- -- ---------- ---------- ---------- ---------- ---------- ----------
3DC34798 3DC347AC 976 TX 65576 1744 0 6 108 0
3D1C6BC4 3D1C6BDC 976 TM 56527 0 3 0 108 0
3D1C6B18 3D1C6B30 988 TM 56527 0 3 0 114 0
3CC346E4 3CC34708 988 TX 65576 1744 6 0 114 1
3DC349C0 3DC349D4 994 TS 3 1 3 0 88278 0
3DC347F4 3DC34808 995 RS 25 1 2 0 88285 0
3DC346E0 3DC346F4 995 XR 4 0 1 0 88290 0
3DC3473C 3DC34750 995 CF 0 0 2 0 88290 0
3DC348AC 3DC348C0 996 RT 1 0 6 0 88285 0
3DC34B30 3DC34B44 997 MR 4 0 4 0 88282 0
3DC34B8C 3DC34BA0 997 MR 5 0 4 0 88282 0
3DC34BE8 3DC34BFC 997 MR 6 0 4 0 88282 0
3DC34A78 3DC34A8C 997 MR 2 0 4 0 88282 0
3DC34CA0 3DC34CB4 997 MR 8 0 4 0 88282 0
3DC34CFC 3DC34D10 997 MR 201 0 4 0 88282 0
3DC34A1C 3DC34A30 997 MR 1 0 4 0 88282 0
3DC34AD4 3DC34AE8 997 MR 3 0 4 0 88282 0
3DC34C44 3DC34C58 997 MR 7 0 4 0 88282 0
-------- -------- ----- -- ---------- ---------- ---------- ---------- ---------- ----------
3DC34798 3DC347AC 976 TX 65576 1744 0 6 108 0
3D1C6BC4 3D1C6BDC 976 TM 56527 0 3 0 108 0
3D1C6B18 3D1C6B30 988 TM 56527 0 3 0 114 0
3CC346E4 3CC34708 988 TX 65576 1744 6 0 114 1
3DC349C0 3DC349D4 994 TS 3 1 3 0 88278 0
3DC347F4 3DC34808 995 RS 25 1 2 0 88285 0
3DC346E0 3DC346F4 995 XR 4 0 1 0 88290 0
3DC3473C 3DC34750 995 CF 0 0 2 0 88290 0
3DC348AC 3DC348C0 996 RT 1 0 6 0 88285 0
3DC34B30 3DC34B44 997 MR 4 0 4 0 88282 0
3DC34B8C 3DC34BA0 997 MR 5 0 4 0 88282 0
3DC34BE8 3DC34BFC 997 MR 6 0 4 0 88282 0
3DC34A78 3DC34A8C 997 MR 2 0 4 0 88282 0
3DC34CA0 3DC34CB4 997 MR 8 0 4 0 88282 0
3DC34CFC 3DC34D10 997 MR 201 0 4 0 88282 0
3DC34A1C 3DC34A30 997 MR 1 0 4 0 88282 0
3DC34AD4 3DC34AE8 997 MR 3 0 4 0 88282 0
3DC34C44 3DC34C58 997 MR 7 0 4 0 88282 0
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-669827/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- v$session之小測試(二)_與v$sqlSessionSQL
- v$session之小測試(三)_與dba_objectsSessionObject
- v$transaction事務_v$session會話_v$rollstat_v$rollname關聯測試_概念Session會話
- select for update_v$lock_dml小測試(鎖型別及模式)型別模式
- V$SESSIONSession
- V$session 檢視的小運用Session
- 【Oracle】-【v$session】v$session的SNIPED狀態OracleSession
- 關於v$process與v$session中process的理解Session
- v session_wait v session_event v system_eventSessionAI
- v$session_event , v$system_event , v$session_waitSessionAI
- oracle lock鎖_v$lock_轉Oracle
- 幾個檢視 v$mystat v$systata v$sessionSession
- v$session的一點認知Session
- Oracle動態效能檢視學習之v$lock & v$locked_objectOracleObject
- session和v$session說明Session
- oracle v$lock詳解Oracle
- 【SESSION】v$session and v$license 中sessions_current 的區別Session
- v$session_wait和v$session_event檢視SessionAI
- V$session 及該檢視的小運用Session
- 10.17 V$SESSIONSession
- V$SESSION COMMANDSession
- v$Session詳解Session
- v$session 檢視Session
- v$session與v$sql連線現在使用哪個欄位?SessionSQL
- 幾個重要檢視(V$SYSTEM_EVENT V$SESSION_EVENT V$SESSION_WAIT)SessionAI
- oracle v$lock系列之三Oracle
- 【DOC】VIEW: "V$LOCK" Reference NoteView
- 軟體測試模型-V 模型模型
- v$action_session_historySession
- V$SESSION_LONGOPSSessionGo
- v$session的解釋Session
- v$session的來源Session
- v$session中的serverSessionServer
- V$SESSION_WAITSessionAI
- 10G V$SESSIONSession
- v$session表的妙用Session
- V$session 表的妙用Session
- v$process和v$session中欄位解釋Session