同事在Toad里面执行SQL语句时,突然无线网络中断了,让我检查一下具体情况,如下所示(有些信息,用xxx替换,因为是在处理那些历史归档数据,使用的一个特殊用户,所以可以用下面SQL找到对应的会话信息):

SQL> SELECT B.USERNAME     , 

  2         B.SID          , 

  3         B.SERIAL#      ,

  4         LOGON_TIME     ,

  5         A.OBJECT_ID

  6    FROM V$LOCKED_OBJECT A, V$SESSION B

  7   WHERE A.SESSION_ID = B.SID AND B.USERNAME=&USERNAME

  8   ORDER BY B.LOGON_TIME;

 

USERNAME                              SID    SERIAL# LOGON_TIM  OBJECT_ID

------------------------------ ---------- ---------- --------- ----------

xxxxxx                                523      41890 06-MAY-16     825891

xxxxxx                                523      41890 06-MAY-16     825892

执行了kill会话的语句后,检查发现对应的会话仍然存在,只是SERIAL#值变化了,再次去kill会话时,出现ORA-00030错误,如下所示

SQL> alter system kill session '523, 41890' immediate;

 

System altered.

 

 

SQL> SELECT  A.ORACLE_USERNAME  ,

  2          A.OS_USER_NAME     ,

  3          B.OWNER            ,

  4          B.OBJECT_NAME      , 

  5          A.SESSION_ID       ,

  6          A.PROCESS          ,

  7          A.LOCKED_MODE

  8    FROM V$LOCKED_OBJECT A, DBA_OBJECTS B

  9   WHERE B.OBJECT_ID = A.OBJECT_ID AND  B.OWNER=&OWNER

 10  ORDER BY  A.ORACLE_USERNAME,

 11            A.OS_USER_NAME;

 

ORACLE_USERNAME   OS_USER_NAME     OWNER       OBJECT_NAME        SESSION_ID PROCESS   LOCKED_MODE

---------------- ------------- -----------   ----------------- ----------------------  -------------

xxxxxxxxxxxxxxx    ZhanxxxnL   xxxxxxxxxxxx    INV_xxxx_HD       523 6208:7548               3

xxxxxxxxxxxxxxx    ZhanxxxxL   xxxxxxxxxxxx    INV_xxxx_LINES    523 6208:7548               3

 

SQL> SELECT B.USERNAME    , 

  2      B.SID            , 

  3      B.SERIAL#        ,

  4      LOGON_TIME       ,

  5      A.OBJECT_ID

  6    FROM V$LOCKED_OBJECT A, V$SESSION B

  7   WHERE A.SESSION_ID = B.SID

     AND  B.USERNAME=&USERNAME

  8   ORDER BY B.LOGON_TIME;

 

USERNAME                              SID    SERIAL# LOGON_TIM  OBJECT_ID

------------------------------ ---------- ---------- --------- ----------

xxxxxxxxxxxxxx                        523      41891 06-MAY-16     825892

xxxxxxxxxxxxxx                        523      41891 06-MAY-16     825891

 

 

SQL> alter system kill session '523, 41891' immediate;

alter system kill session '523, 41891' immediate

*

ERROR at line 1:

ORA-00030: User session ID does not exist.

在metalink上,查看了ORA-00030错误的描述、原因、解决方案。如下所示

SQL> ho oerr ora 30

00030, 00000, "User session ID does not exist."

// *Cause: The user session ID no longer exists, probably because the

// session was logged out.

// *Action: Use a valid session ID.

The command may have been issued for one or more of the following reasons:

1. The process no longer exists at the os level, but does show up as active in v$session.

2. The user reboots the client machine without logging off, leaving a shadow process.

3. That session is holding onto a lock that needs to be released.

CAUSE

This error occurs because PMON is already trying to kill the session.

This is indicated by the fact that the serial number keeps changing.

When PMON attempts to cleanup a dead session, it will increase the serial number.

PMON may take a long time to clean up the process. If the process was doing a very large transaction at the time it aborted, then PMON has to rollback the large transaction.

When PMON makes progress, i.e. if it manages to free at least some of the process's resource, it will repeatedly keep trying to delete the process. When it finally gets to the point where it can't free up any of the process's resource (i.e. there are no more free buffers), it will print a message to the trace file and try to delete that process a second time.

The problem is encountered when PMON lacks the resources needed to remove the process. If there are not enough buffers, then the removal of  the process is delayed. This is a free buffer problem in the data cache.

SOLUTION

Encountering an ORA-30 when attempting to manually kill a process is not necessarily a bug but a result of trying to kill a process already marked as killed.

PMON can take anywhere from 5 minutes to over 24 hours to clean up a job. The impact is that often the process being cleaned up is holding locks that prevents others from performing certain operations.

The solution is to wait for PMON to clean up the process.

基本上只能等待pmon进程回收处理这个进程,等了十来分钟,这个会话进程还是没有被清理,于是我查看了一下会话的相关信息,在网上查看到相关资料,可以从系统层面kill掉会话

SQL> 

 

SQL> select event from v$session_wait where sid=523;

 

EVENT

----------------------------------------------------------------

db file sequential read

 

SQL> select sql_text from v$session a,v$sqltext_with_newlines b

  2    where decode(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value

  3    and a.sid=&sid order by piece;

Enter value for sid: 523

old   3:   and a.sid=&sid order by piece

new   3:   and a.sid=523 order by piece

 

SQL_TEXT

----------------------------------------------------------------

DELETE from inv_xxx_lines WHERE (xxx) IN ( SELECT tr

ans_line_id FROM xxxx GROUP BY trans_line_id HAVING C

OUNT(xxxxx) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FRO

M xxxx GROUP BY xxx HAVING COUNT(*) > 1)

于是我尝试从系统层面kill掉对应的系统进程。执行完成后,验证发现对应的会话已经Kill掉了。不知道是凑巧pmon进程回收了这个会话进程还是真的能从系统进程能kill掉(因为不能重新这种场景),如果下次碰到这种场景,就可以测试、验证了。特此记录一下

SQL> ! kill -9 4884

 

参考资料:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=533785808734847&id=1011386.6&_afrWindowMode=0&_adf.ctrl-state=13ipo04jjr_4

http://www.linuxidc.com/Linux/2011-09/43730.htm

ORA-00030: User session ID does not exist.的更多相关文章

  1. 【ORA】ORA-00030: User session ID does not exist.

    今天巡检,查询锁相关的情况的时候,确认业务后,准备将锁干掉,但是干掉的时候报了一个错误,ORA-00030 发现回话不存在,我以为pmon进程已经将锁进程kill掉了,就再次查看,发现,还是存在 这个 ...

  2. Infinite loop when using cookieless session ID on Azure

    If you use cookieless session ID and deploy them on Azure, you might get infinite loop when you quer ...

  3. 【转】Session ID/session token 及和cookie区别

    Session + Cookie  知识收集! cookie机制采用的是在客户端保持状态的方案.它是在用户端的会话状态的存贮机制,他需要用户打开客户端的cookie支持.cookie的作用就是为了解决 ...

  4. Session id实现通过Cookie来传输方法及代码参考

    1. Web中的Session指的就是用户在浏览某个网站时,从进入网站到浏览器关闭所经过的这段时间,也就是用户浏览这个网站所花费的时间.因此从上述的定义中我们可以看到,Session实际上是一个特定的 ...

  5. 获得创建临时表的session id

    通过sql server的default trace和tempdb中的sys.objects视图,你能够获得创建临时表的session id,下面是相应的sql语句: DECLARE @FileNam ...

  6. Item with the same id "98" already exist

    在magento项目中多次遇到这样一个错误: Item (Bluecom_Onefieldusername_Model_Customer) with the same id "98" ...

  7. 【从翻译mos文章】正在实施的获取job的 session id

    正在实施的获取job的 session id 参考原始: How to get the session Id of the Running Job (Doc ID 1604966.1) 申请: Ora ...

  8. [解决]Linux Tomcat启动慢--Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [236,325] milliseconds

    一.背景 今天部署项目到tomcat,执行./startup.sh命令之后,访问项目迟迟加载不出来,查看日志又没报错(其实是我粗心了,当时tomcat日志还没打印完),一开始怀疑是阿里云主机出现问题, ...

  9. Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [33,755] milliseconds.

    刚部署好程序,第一次登录时,加载非常得慢,查看log日志发现:Creation of SecureRandom instance for session ID generation using [SH ...

随机推荐

  1. 介绍开源的.net通信框架NetworkComms框架 源码分析(十四)StreamTools

    原文网址: http://www.cnblogs.com/csdev Networkcomms 是一款C# 语言编写的TCP/UDP通信框架  作者是英国人  以前是收费的 目前作者已经开源  许可是 ...

  2. C#制作RDLC报表

    报表以前我只做过水晶报表,但是最近发现家里的VS上面居然没有水晶报表,发现水晶报表现在貌似已经不能完全免费的使用了,为了保险起见,就用了VS自带的RDLC报表,用完感觉其实也是够用的嘛~ 建立一RDL ...

  3. XMPP客户端开发(2)--发送接收消息

    客户端连接上服务器并登录以后,可以发送.接收消息. 首先需要定义Chat,MessageListener和ChatMessageListener几个变量: private static Chat ch ...

  4. struts2、jsp的简单路径的简单拦截

    <filter> <filter-name>UsersFilter</filter-name> <filter-class>com.web.UsersF ...

  5. android 密码输入通过复选框实现明文密文显示

    editText1.setTransformationMethod(HideReturnsTransformationMethod.getInstance());//将文本框的内容以明文显示 edit ...

  6. LinuxMint 17.1 Cinnamon桌面窗口焦点bug

    LinuxMint 升级到 17.1后,发现桌面彻底不爽了. 发现各应用窗口经常无法正常获取焦点,必须用Alt + Tab切换才能解锁. 乌龙...

  7. Data Structures/Algorithms 小甲鱼99讲笔记系列(1~~15讲)

    参考资料地址: http://www.icoolxue.com/ 1.数据结构中四种逻辑结构. ① 集合 集合中任何两个数据元素之间都没有逻辑关系,组织形式松散. ② 线性结构 线性结构中的 结点按逻 ...

  8. Scalaz(10)- Monad:就是一种函数式编程模式-a design pattern

    Monad typeclass不是一种类型,而是一种程序设计模式(design pattern),是泛函编程中最重要的编程概念,因而很多行内人把FP又称为Monadic Programming.这其中 ...

  9. ThinkCMF-首页Nav部分菜单配置详解

    Nav菜单代码放在了 /themes/simplebootx/Public/nav.html 具体代码: <?php $effected_id="main-menu"; $f ...

  10. 初学C++之自定义类型名简化

    说明:本人使用的是vc++ IDE:vs2013 我在自定义一些类时,有时会取一些很长的名字,但是这不利于使用,这个时候就可以使用类型名简化. class MathAddBBBB { }; using ...