博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

查看DDL语言被锁的方法

Posted on 2012-01-04 10:30  奥客  阅读(236)  评论(0编辑  收藏  举报

--先查出被锁的会话id

select * from dba_ddl_locks a  where upper( a.name)=upper('secom_pcdi_pkg')

 

--查出会话是谁

 select sa.MODULE,
       sl.OPNAME,
       to_char(sl.start_time, 'yyyy-mm-dd hh24:mi:ss') start_time,
       sa.SQL_TEXT,
       pr.*,
       '||',
       se.*
from v$session se, v$process pr, v$session_longops sl, v$sqlarea sa
where se.PADDR = pr.ADDR(+)
and se.SID = sl.SID(+)
and sl.sql_hash_value = sa.hash_value(+)
 
--and se.module like  '%' || upper('macarena_xi') || '%'
--and sl.START_TIME is not null
--and pr.SPID in (32257)
 and se.SID in (
40
,330
,349)