v$access:displays information about locks that are currently imposed on library cache objects
v$access.type有:CURSOR、FUNCTION、JAVA CLASS、LIBRARY、NON-EXISTENT、PACKAGE、
PROCEDURE、SEQUENCE、SYNONYM、TABLE、TRIGGER、TYPE、VIEW
--查指定Table有誰在使用
select vs.sid,vs.serial#,va.object,vs.module,vs.action,vs.machine,vs.paddr,vs.sql_address
from v$access va,v$session vs where va.sid=vs.sid and owner <> 'SYS'
and va.type='TABLE'
and object='tmp_ccc';
--查Procedure有誰在使用
select vs.sid,vs.serial#,va.object,vs.module,vs.action,vs.machine,vs.paddr,vs.sql_address
from v$access va,v$session vs where va.sid=vs.sid and owner <> 'SYS'
and va.type='PROCEDURE'
and object='WPRP106_TMP';
有時候我們的報表服務中心因為Procedure執行太久,被我們強制中斷後,Session仍然還在Oracle內執行,
就可以用上列的SQL找出SID後,再將它Kill以釋放被Lock住的物件。