在ORACLE 12C下kill掉一个作业的会话时遇到错误:ORA-00026: missing or invalid session ID。
SQL> ALTER SYSTEM KILL SESSION '532,18010' IMMEDIATE;
ALTER SYSTEM KILL SESSION '532,18010' IMMEDIATE
*
ERROR at line 1:
ORA-00026: missing or invalid session ID
反复确认过会话ID依然有效,而且会话也处于ACTIVE状态,找出会话对应的SPID后,在操作系统层面,使用kill -9 xxx命令杀掉对应的进程后,问题虽然解决了,但是依然觉得有点不可思议,实在有点想不通,觉得有点匪夷所思。这与通常遇到的ORA-00026错误有点不同。
ORA-00026 missing or invalid session ID
Cause: The session ID string specified in the ALTER SYSTEM KILL SESSION command was invalid, or no string was specified.
Action: Retry the command with a valid session ID.
后面搜索到相关资料“Alter System Kill Session Failed With ORA-00026 When Kill a Job Session From PDB (Doc ID 2491701.1)”,看完这个资料后才知道遇到了一个Bug,我是在PDB下面kill会话,所以刚好遇到了这个Bug。解决方法也非常简单,在root container中kill会话,或者使用DBMS_SCHEDULER.STOP_JOB停止作业,当然,在操作系统层面kill掉相关进程也是没有问题的。
下面内容摘抄自Alter System Kill Session Failed With ORA-00026 When Kill a Job Session From PDB (Doc ID 2491701.1),方便阅读参考。
APPLIES TO:
Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.
SYMPTOMS
When killing a job session from pdb level see below error:
ORA-00026: missing or invalid session ID
CAUSE
This is an expected behavior. As explained in bug:
Bug 25240144 : THE ALTER SYSTEM KILL SESSION FAILED WITH ORA-00026 TO KILL DBMS_SCHEDULER JOB
Job secondary are spawned in the root container because they are a shared resource among PDBs, it is not feasible to implement them as a per PDB resource since the number of PDBs will grow in the future.
SOLUTION
Kill the session from the root container or use stop_job
REFERENCES
BUG:22578465 - NOT ABLE TO KILL THE SESSION FROM PDB STARTED ON PDB BUT ABLE TO KILL FROM ROOT
文章转载自DBA闲思杂想录,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




