下面4个语句是我经常使用来解决oracle锁问题的 -- 注意你的用户有没有权限问题
1. 查看被锁的表
SELECT p.spid, a.serial#, c.object_name, b.session_id, b.oracle_username,
b.os_user_name
FROM v$process p, v$session a, v$locked_object b, all_objects c
WHERE p.addr = a.paddr AND a.process = b.process
AND c.object_id = b.object_id
2. 查看是哪个进程锁的
SELECT sid, serial#, username, osuser FROM v$session where osuser = 'tangpj'
1. 查看被锁的表
SELECT p.spid, a.serial#, c.object_name, b.session_id, b.oracle_username,
b.os_user_name
FROM v$process p, v$session a, v$locked_object b, all_objects c
WHERE p.addr = a.paddr AND a.process = b.process
AND c.object_id = b.object_id
2. 查看是哪个进程锁的
SELECT sid, serial#, username, osuser FROM v$session where osuser = 'tangpj'
我操作的...
--3.查出锁定表的sid, serial#,os_user_name, machine_name, terminal,锁的type,mode
SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine,
s.terminal, s.logon_time, l.type
FROM v$session s, v$lock l
WHERE s.sid = l.sid
AND s.username IS NOT NULL
ORDER BY sid;
4. 杀掉这个进程 alter system kill session 'sid,serial#';