Oracle中查锁

SELECT obj.OWNER || '.' || obj.OBJECT_NAME AS OBJ_NAME, -- 对象名称(已经被锁住)

obj.SUBOBJECT_NAME AS SUBOBJ_NAME, --子对象名称(已经被锁住)

obj.OBJECT_ID AS OBJ_ID, -- 对象ID

obj.OBJECT_TYPE AS OBJ_TYPE, -- 对象类型

lock_obj.SESSION_ID AS SESSION_ID, --会话SESSION_ID

lock_obj.ORACLE_USERNAME AS ORA_USERNAME, -- ORACLE系统用户名称

lock_obj.OS_USER_NAME AS OS_USERNAME, -- 操作系统用户名称

lock_obj.PROCESS AS PROCESS -- 进程编号

FROM (SELECT *

FROM all_objects

WHERE object_id IN (SELECT object_id FROM v$locked_object)) obj,

v$locked_object lock_obj

WHERE obj.object_id = lock_obj.object_id;

 

SELECT V$SESSION.sid,

v$session.SERIAL#,

v$process.spid,

rtrim(object_type) object_type,

rtrim(owner) || '.' || object_name object_name,

decode(lmode,

0, 'None',

1, 'Null',

2, 'Row-S',

3, 'Row-X',

4, 'Share',

5, 'S/Row-X',

6, 'Exclusive',

'Unknown') LockMode,

decode(request,

0, 'None',

1, 'Null',

2, 'Row-S',

3, 'Row-X',

4, 'Share',

5, 'S/Row-X',

6, 'Exclusive',

'Unknown') RequestMode,

ctime,

BLOCK b,

v$session.username,

MACHINE,

MODULE,

ACTION,

decode(A.TYPE,

'MR', 'Media Recovery',

'RT', 'Redo Thread',

'UN', 'User Name',

'TX', 'Transaction',

'TM', 'DML',

'UL', 'PL/SQL User Lock',

'DX', 'Distributed Xaction',

'CF', 'Control File',

'IS', 'Instance State',

'FS', 'File Set',

'IR', 'Instance Recovery',

'ST', 'Disk Space Transaction',

'TS', 'Temp Segment',

'IV', 'Library Cache Invalida-tion',

'LS', 'Log Start or Switch',

'RW', 'Row Wait',

'SQ', 'Sequence Number',

'TE', 'Extend Table',

'TT', 'Temp Table',

'Unknown') LockType

FROM (SELECT * FROM V$LOCK) A, all_objects, V$SESSION, v$process

WHERE A.sid > 6

AND object_name <> 'OBJ$'

AND A.id1 = all_objects.object_id

AND A.sid = v$session.sid

AND v$process.addr = v$session.paddr;

转载于:https://www.cnblogs.com/wake/archive/2009/03/27/1423323.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值