我想运行ALTER PACKAGE MONITORING COMPILE;
,因为MONITORING包在SQL Developer中标有红色X,但需要很长时间才能停止它。
我运行以下代码来查找锁:
COLUMN lock_id2 FORMAT A30
select to_char(SESSION_ID,'999') sid ,
substr(LOCK_TYPE,1,30) Type,
substr(lock_id1,1,45) Object_Name,
substr(mode_held,1,4) HELD,
substr(mode_requested,1,4) REQ,
lock_id2 lock_addr
FROM dba_lock_internal
WHERE
mode_requested <> 'None'
and mode_requested <> mode_held
;
我打印26 Body Definition Pin SCHEMA.MONITORING None Excl 00007FFC744CBDE8
。
然后我查找SID 26:
SELECT s.sid,
NVL(s.username, 'ORACLE PROC') username,
s.osuser,
p.spid os_pid,
s.program,
t.sql_text
FROM v$session s,
v$sqltext t,
v$process p
WHERE s.sql_hash_value = t.hash_value
AND s.paddr = p.addr
AND s.sid = &session_id
AND t.piece = 0 -- optional to list just the first line
ORDER BY s.sid, t.hash_value, t.piece
/
输出:
26 SCHEMA SYSTEM 3096 ORACLE.EXE (J000) call SCHEMA.MONITORING.UPDATE_MONITORING_STATUS ( )
。
然后我尝试运行ALTER SYSTEM KILL SESSION '26,3096';
它告诉我ORA-00030: User session ID does not exist.
。这可能是因为我已经杀了这个会议。
如何删除不想消失的SID 26的锁?
更新: 当我运行时:
select
x.*, y.*
from
v$session x, v$sqltext y
where
x.sql_address = y.address
and
y.sql_text like '%MONITORING%';
然后我得到一个不同的序列号:5479
。我应该用它来阻止它吗?我现在有点害怕,因为我通过杀死随机会话搞乱了。
完整的输出是:
00007FFC73BB0A58 26 5479 17225222 00007FFC73F88180 63 SCHEMA 170 2147483644 00007FFC70F229E0 ACTIVE DEDICATED 63 SCHEMA SYSTEM 3096 PC-ORACLE 0 PC-ORACLE ORACLE.EXE (J000) USER 00007FFC53C7B3E0 2898280916 1sr6azaqc0hfn 0 13.06.18 16803054 00007FFC74434680 1115215392 c6awqs517jpj0 0 13.06.18 16805538 DBMS_SCHEDULER 2478762354 Update_Monitoring_Status 1070683900 1668888 -1 0 0 0 59 13.06.18 2565 NO NONE NONE NO OTHER_GROUPS DISABLED DISABLED DISABLED 0 VALID 1 32 VALID 1 32 9 284 library cache pin handle address 140722259672552 00007FFC744CBDE8 pin address 140721866230184 00007FFC5CD949A8 100*mode+namespace 210629491294211 0000BF9100020003 3875070507 4 Concurrency 0 765 WAITING 764790485 135209515 0 SYS$USERS DISABLED FALSE FALSE FIRST EXEC 100 00007FFC73F88180 80 00007FFC53C7B3E0 2898280916 1sr6azaqc0hfn 170 0 call SCHEMA.MONITORING.UPDATE_MONITORING_STATUS ( )
当我使用这些最后一个参数断开会话时,我得到ORA-00030: User session ID does not exist.
。