check_lock.sql脚本,
列出对象锁(锁)信息及其被杀的会话(sid,连环#)信息
set linesize 132年,pagesize 66,
break 提醒Kill 提醒username 提醒terminal
column Kill  heading “Kill 字符串”,format a13
column res  heading “Resource 类型”,format 999年,
column id1  format 9999990,
column id2  format 9999990,
column lmode  heading “Lock 举行”,format a20
column request  heading “Lock 要求”,format a20
column 串行#,format 99999,
column username , format a10 , heading “用户名”,
column terminal  heading Term format  a6
column tab  format a35  heading “Table 名称”,
column owner  format a9
column Address  format a18
column ctime  heading “秒”
选择nvl (S.USERNAME,“内部”),用户名,,
nvl (S.TERMINAL '没有'),终端,,
L.SID | |”、“| | S.SERIAL #,,,
U1.NAME | | ' . ' | | substr (T1.NAME 1 20),标签,,
解码(L.LMODE 1“No 锁”,,
2、“Row 分享”,
3、“Row 排斥”,
4、“分享”,
5“Share Row 专属”,
6、“独家”,null), lmode,,
解码(L.REQUEST 1“No 锁”,,
2、“Row 分享”,
3、“Row 排斥”,
4、“分享”,
5“Share Row 专属”,
6、“独家”,null),请求,
,,,,,,l.ctime
从v $ LOCK L,,,
V $ SESSION ,,
SYS.USER美元,U1,,
SYS.OBJ美元,T1
l.sid =时间S.SID 大敌;;
和t1.obj #,=,解码(L.ID2 0 L.ID1 L.ID2),,
和u1.user #,=, T1.OWNER #,
和s.type !=,“背景”,
order by 1、2、5,/,
会话1:
以斯科特用户登录创建一个表t1
(root@Oel_10G ~) #, su 作用;oracle
(oracle@Oel_10G ~),美元sqlplus 斯科特/oracle
完成,create table  t1 (小姐:int),,,,,,,,,,,,,
Table 创建。
完成,insert into  t1 价值(1);
1,row 创建。
完成,提交;
Commit 完成。
在会话1中给t1加一个锁
完成,select *,得到,t1 for 更新;
,,,,,,,我
----------
,,,,,,,,1
会话,2:
在会话2中更新t1表的一行,,由于t1表中有Row 独家锁,此时会话2获取不到锁暂时为挂起状态
(root@Oel_10G ~) #, su 作用;oracle
(oracle@Oel_10G ~),美元sqlplus 斯科特/oracle
完成,update t1  set 我=3,where i=1;
会话,3:
在会话3中更新t1表的一行,,由于t1表中有Row 独家锁,此时会话3获取不到锁暂时为挂起状态
(root@Oel_10G ~) #, su 作用;oracle
(oracle@Oel_10G ~),美元sqlplus 斯科特/oracle
完成,update ,, t1 set 我=5,where i=1;
会话,4:
新开一个会话,以sys登陆,执行lock_check.sql查看相关对象锁信息
(root@Oel_10G ~) #, su 作用;oracle
(oracle@Oel_10G ~),美元sqlplus /, as sysdba
完成@check_lock.sql
Username ,, Term ,, Kill String ,, Table Name ,,,,,,,,,,,,,,,,,,,,,,,,, Lock Held ,,,,,,,,,,, Lock Requested ,,,,,,,,,秒
- - - - - - - - - - -,- - - - - -,- - - - - - - - - - - -安康;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -女人,- - - - - - - - - - - - - - - - - - - - - -,- - - - - - - - - - - - - - - - - - - - - -,- - - - - - - - - - -
SCOTT ,,,,,分/1,,525891,,,,,,,PUBLIC.V SQLAREA_PLAN_HASH 美元;,,,,,,,,,Exclusive ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 108
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,SCOTT.T1 ,,,,,,,,,,,,,,,,,,,,,,,,,,, Row Exclusive ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 108
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null