自己在修改一张表的时候无法修改,报出一下错误: 系统正忙,但指定以nowait方式获取资源,或者超时失效
经查找是表被锁了,查看表被谁锁的方法如下:
SELECT /*+ rule */
s.username,
decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', NULL) LOCK_LEVEL,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#
FROM gv$session s, gv$lock l, dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL;
USERNAME LOCK_LEVEL OWNER OBJECT_NAME OBJECT_TYPE SID SERIAL#
--------- ----------------- ---------- ------------- ----------- ----- ----------
REPORT TABLE LOCK REPORT PRP_EMP TABLE 147 1366
断开他的session就可以执行了:
alter system kill session '147,1366';