存在很多oracle 会话,oracle遭遇大量SNIPED会话

如果user的profile设置了non-zero的idle time,则以该用户登录的session在空闲一定时间后会变成SNIPED.

今天生产库上碰到一个案例,版本10205,processes=1200

客户说登录不上,以sysdba本地登录,

sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Wed Jul 17 01:41:30 2013

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected.

SQL>

典型的processes满了,杀死几个local=no的进程后才成功登陆

SQL> select status,count(*) from v$session group by status order by 2;

STATUS     COUNT(*)

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

ACTIVE           24

INACTIVE         49

SNIPED         1124

SQL> select USERNAME,status,count(*) from v$session group by USERNAME,status order by 3;

USERNAME                       STATUS     COUNT(*)

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

……

SYNCIT                         SNIPED         1120

12 rows selected.

SQL> select profile from dba_users where username='SYNCIT';

PROFILE

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

PROFILE_IDLE_TIMEOUT

SQL> select RESOURCE_NAME,LIMIT from dba_profiles where profile='PROFILE_IDLE_TIMEOUT';

RESOURCE_NAME                    LIMIT

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

IDLE_TIME                        1

IDLE_TIME设置为1分钟

What does 'SNIPED' status in v$session mean?

When IDLE_TIME is set in the users' profiles or the default profile. This will kill the sessions in the database (status in v$session now becomes SNIPED) and they will eventually disconnect. It does not always clean up the Unix session (LOCAL=NO sessions).

At this time all oracle resources are released but the shadow processes remains and OS resources are not released. This shadow process is still counted towards the parameters of init.ora.

This process is killed and entry from v$session is released only when user again tries to do something. Another way of forcing disconnect (if your users come in via SQL*Net) is to put the file sqlnet.ora on every client machine and include the parameter "SQLNET.EXPIRE_TIME" in it to force the close of the SQL*Net session

sqlnet.expire_time

sqlnet.expire_time actually works on a different principle and is used to detect dead connections as opposed to disconnecting(actually 'sniping') a session based on idle_time which the profile accomplishes.

But again, as you mentioned, expire_time works globally while idle_time profile works for that user. You can use both of them to make sure that the client not only gets sniped but also gets disconnected if the user process abnormally terminates.

也可写个shell脚本定时kill sniped session

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当一个会话Oracle 数据库强制关闭时,该会话被称为被 sniped。这通常是由于会话执行时间过长或由于资源限制引发的。在 PL/SQL 中,可以通过查看数据库的日志文件或在 SQL Developer 中分析会话的跟踪文件来分析被 sniped会话。 以下是一般的分析步骤: 1. 查看数据库的日志文件:在 Oracle 数据库中,可以查看 alert.log 或 listener.log 文件来查找有关 sniped 会话的信息。这些文件通常位于 $ORACLE_HOME/diag 目录下,可以通过查看最近的日志来确定何时发生了 sniped。 2. 查看会话的跟踪文件:可以在 SQL Developer 中使用“TKPROF”工具来分析会话的跟踪文件。首先需要启用 SQL_TRACE 参数,然后在会话结束时,会生成一个跟踪文件。可以使用以下命令生成跟踪文件: ``` ALTER SESSION SET SQL_TRACE=TRUE; ``` 在跟踪文件生成后,可以使用以下命令来分析: ``` TKPROF tracefile outputfile explain=username/password ``` 其中,tracefile 是跟踪文件的路径,outputfile 是结果文件的路径,explain 是可选参数,用于显示 SQL 语句的执行计划。 3. 分析执行计划:在分析跟踪文件时,可以查看 SQL 语句的执行计划,以确定是否存在性能问题。可以使用以下命令查看 SQL 语句的执行计划: ``` EXPLAIN PLAN FOR sql_statement; ``` 然后可以使用以下命令查看执行计划: ``` SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); ``` 这些步骤可以帮助您分析被 sniped会话,并找出导致性能问题的原因。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值