我昨天也这样试过,但出来的结果和预料相差很远。
wyq@ORCL>update emp set ename = ename;
12 rows updated.
wyq@ORCL>get lock
line 16 truncated.
1 /* showalllock.sql */
2 column username format a6
3 column object_name format a13
4 column o_name format a13
5 column lock_type format a13
6 column object_name format a13
7 column type format a5
8 select s.username,l.sid,l.type,l.id1,l.id2,o.object_name,
9 decode(l.lmode,0,'None', 1,'Null', 2,'Row Share',
10 3,'Row Exclusive', 4,'Share', 5,'Share Row Exclusive',
11 6,'Exclusive') lock_type,l.request,l.ctime,l.block
12 from v$lock l,v$session s,dba_objects o
13 where l.type in ('TX','TM')
14 and l.sid = s.sid
15* and l.id1 = o.object_id(+)
16
wyq@ORCL>ed
Wrote file afiedt.buf
1 select s.username,l.sid,l.type,l.id1,l.id2,o.object_name,
2 decode(l.lmode,0,'None', 1,'Null', 2,'Row Share',
3 3,'Row Exclusive', 4,'Share', 5,'Share Row Exclusive',
4 6,'Exclusive') lock_type,l.request,l.ctime,l.block,x.sql_text
5 from v$lock l,v$session s,dba_objects o,v$sql x
6 where l.type in ('TX','TM')
7 and l.sid = s.sid
8 and l.id1 = o.object_id(+)
9* and s.sql_hash_value = x.hash_value
wyq@ORCL>/
USERNA SID TYPE ID1 ID2 OBJECT_NAME LOCK_TYPE REQUEST CTIME BLOCK
------ ---------- ----- ---------- ---------- ------------- ------------- ---------- ---------- ----
SQL_TEXT
----------------------------------------------------------------------------------------------------
WYQ 18 TX 393238 112 Exclusive 0 120 0
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
WYQ 18 TM 6492 0 EMP Row Exclusive 0 120 0
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
wyq@ORCL>
每行的结果都是如此。