ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【Oracle】-【SNIPED和KILLED】-SPINED和KILLED的session清理流程

【Oracle】-【SNIPED和KILLED】-SPINED和KILLED的session清理流程

原创 Linux操作系统 作者:bisal 时间:2013-07-26 10:07:59 0 删除 编辑

@dbsnake大拿的一个示例:

SQL> show parameter limit
NAME     TYPE  VALUE
------------------------------------ ----------- ------------------------------
asm_power_limit     integer 1
java_soft_sessionspace_limit     integer 0
resource_limit     boolean TRUE


SQL> create profile idletime limit idle_time 1;
Profile created.


SQL> alter user bisal profile idletime;
User altered.


SQL> conn bisal/bisal


From another session:

SQL> select status from v$session where username='BISAL';
STATUS
--------
ACTIVE
INACTIVE


After one minute:

SQL> select status from v$session where username='BISAL';
STATUS
--------
ACTIVE
SNIPED


From BISAL session:

SQL> select * from dual;
select * from dual
*
ERROR at line 1:
ORA-02396: exceeded maximum idle time, please connect again


From another session:

SQL> select status from v$session where username='BISAL';
STATUS
--------
ACTIVE


验证一个SNIPED的session,重新执行一条SQL,Oracle会自动删除该session


再做一个实验:

Conn bisal

From another session:

SQL> select status from v$session where username='BISAL';

STATUS
--------
ACTIVE
INACTIVE


SQL> select username,serial#, sid, to_timestamp(logon_time) from v$session
  2  where username='BISAL';

USERNAME  SERIAL# SID            TO_TIMESTAMP(LOGON_TIME)
---------------------------------------------------------------------------
BISAL 8  208                   10-JUL-13 12.00.00 AM
BISAL       15 215                   10-JUL-13 12.00.00 AM


SQL> alter system kill session '215, 15';
System altered.


SQL> select status from v$session where username='BISAL';
STATUS
--------
ACTIVE
KILLED


From BISAL session:

SQL> select * from dual;
select * from dual
*
ERROR at line 1:
ORA-00028: your session has been killed


From another session:

SQL> select status from v$session where username='BISAL';

STATUS
--------
ACTIVE

即KILLED状态的session执行一个SQL,也会立即清除,这个据@eygle介绍是PMON负责的。"如果此时被Kill的process,重新尝试执行任务,那么马上会收到进程中断的提示,process退出,此时Oracle会立即启动PMON来清除该session.这被作为一次异常中断处理."

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7192724/viewspace-767163/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE,10g/11g OCP,11g OCM,国内首批Oracle YEP成员(Oracle Young Expert Program,Oracle用户组年轻专家项目),EXIN DevOps Master,Oracle爱好者,微信公众号:bisal的个人杂货铺

注册时间:2013-07-26

  • 博文量
    340
  • 访问量
    2627438