解决方法如下:
1:查V$DB_OBJECT_CACHE
SELECT * FROM V$DB_OBJECT_CACHE WHERE name='CRM_LASTCHGINFO_DAY' AND LOCKS!='0';
注意:CRM_LASTCHGINFO_DAY为存储过程的名称。
发现locks=2,
2:按对象查出sid的值
select /*+ rule*/ SID from V$ACCESS WHERE object='CRM_LASTCHGINFO_DAY';
注意:CRM_LASTCHGINFO_DAY为存储过程的名称。
3:查sid,serial#
SELECT SID,SERIAL#,PADDR FROM V$SESSION WHERE SID='刚才查到的SID';
4:alter system kill session 'sid值,serial#值' immediate;
整合一下:
select /*+ rule*/ a.sid, a.serial#, a.paddr, 'alter system kill session ''' || a.sid || ',' || a.serial# || ''';' AS kill_session,b.OBJECT FROM v$session a, v$access b WHERE a.sid = b.sid AND b.OBJECT = UPPER('m_retail_submit');