---該指令碼是用來檢驗系統中誰在鎖表
select a.sid,
b.serial#,
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,
c.object_name,
---b.username,
---b.osuser,
decode(a.lmode,
0, 'none',
1, 'null',
2, 'row-s',
3, 'row-x',
4, 'share',
5, 's/row-x',
6, 'exclusive',
'unknown') lockmode,
b.machine,
d.spid
from v$lock a, v$session b, all_objects c, v$process d
where a.sid = b.sid
and a.type in ('tm', 'tx')
and c.object_id = a.id1
and b.paddr = d.addr ;
---直接執行下面的語句,copy出來直接執行
select 'alter system kill session '''||b.session_id||','||c.serial#||''';'
from all_objects a,v$locked_object b,v$session c where a.object_id=b.object_id and
c.sid=b.session_id;
oracle資料庫表解鎖
我們常常在運算元據庫時會遇到 某個dml操作可能等待很久沒有反應 遇到這種情況多半是因為表被鎖住了,那麼如何解鎖呢?檢視哪個表被鎖 select sess.sid,sess.serial lo.oracle username,lo.os user name,ao.object name,lo.loc...
關於oracle資料庫解鎖
microsoft windows 版本 10.0.14393 c 2016 microsoft corporation。保留所有權利。c windows system32 sqlplus nolog sql plus release 10.2.0.1.0 production on 星期日 7月 ...
oracle資料庫表解鎖
一 使用sql語句查詢鎖的狀態 sql select sess.sid,sess.serial lo.oracle username,lo.os user name,ao.object name,lo.locked mode from v locked object lo,dba objects a...