\\ 查询被锁的对象、来源、sid和serial

select object_name, machine, s.sid, s.serial#
from v$locked_object l, dba_objects o, v$session s
where l.object_id  =  o.object_id
and l.session_id = s.sid

Oracle  update或alter表被锁住的问题-LMLPHP

\\ 杀死会话链接,SID和SERIAL 要对应上

alter system kill session ',';

Oracle  update或alter表被锁住的问题-LMLPHP

\\ 如果报错,则执行以下操作:

尽管报错了,但状态肯定已经变成了KILLED状态

select a.spid,b.sid,b.serial#,b.username
from v$process a,v$session b
where a.addr=b.paddr
and b.status='KILLED';

Oracle  update或alter表被锁住的问题-LMLPHP

\\ 查询系统中的线程ID,即spid,查询到的spid

select b.spid,a.osuser,b.program
from v$session a,v$process b
where a.paddr=b.addr
and a.sid=SID

Oracle  update或alter表被锁住的问题-LMLPHP

\\ 登录数据库系统OS,执行以下命令

kill -9 SPID 

参考网址:

http://blog.sina.com.cn/s/blog_5ceb51480102w8et.html

05-23 19:10