怎么会有390多个session处于activemq 事务session状态

1306人阅读
Oracle DBA(66)

一. Session&状态说明
&&&&&&&&&&&&可以通过v$session&视图的status列查看session&的状态。&&关于该视图的使用,参考联机文档:
VARCHAR2(8)
Status of the session:
ACTIVE - Session currently executing SQL
KILLED - Session marked to be killed
CACHED - Session temporarily cached for use by Oracle*XA
SNIPED - Session inactive, waiting on the client
有关状态的说明:
(1)active&处于此状态的会话,表示正在执行,处于活动状态。
&&&&&&&&&&&&官方文档说明:
&&&&&&&&&&&&Any session that is connected to the database and is waiting for an event that does not belong to the Idle wait
class is considered as an active session.
(2)killed处于此状态的会话,被标注为删除,表示出现了错误,正在回滚。
&&&&&&&&&&&&当然,也是占用系统资源的。还有一点就是,killed的状态一般会持续较长时间,而且用windows下的工具pl/sql
developer来kill掉,是不管用的,要用命令:alter system kill session 'sid,serial#' ;
(3)inactive&处于此状态的会话表示不是正在执行的
&&&&&&&&&&&&该状态处于等待操作(即等待需要执行的SQL语句),通常当DML语句已经完成。&但连接没有释放,这个可能是程序中没有释放,如果是使用中间件来连接的话,也可能是中间件的配置或者是bug&导致。
&&&&&&&&&&&&inactive对数据库本身没有什么影响,但是如果程序没有及时commit,那么就会造成占用过多会话。容易是DB&的session&达到极限值。
&&&&&&&&&&&&问了几个朋友,他们的做法是不处理inactive&状态的session,&如果达到了session&的最大值,&就增加processes&和&sessions&参数。&如果kill
inactive session&可能会到中间件有影响。&具体中间件这块我也不太熟,等以后弄清楚了,在说。
二.&处理inactive&状态的session
&&&&&&&&&&&&在前面说不处理inactive&状态的session,但是还是有方法来解决的。&有两种方法。
2.1&在&sqlnet.ora文件中设置expire_time&参数
官网有关这个参数的说明:
SQLNET.EXPIRE_TIME
&&&&&&&&&&&&Use parameter SQLNET.EXPIRE_TIME to specify a the time interval,&in minutes,
to send a probe to verify that client/server connections are active.&Setting a value greater than 0 ensures that connections are not left open indefinitely, due to an abnormal client termination.&If
the probe finds a terminated connection, or a connection that is no longer in use, it returns an error, causing the server process to exit.&This parameter is primarily intended for the database server, which typically handles multiple connections
at any one time.
&&&&&&&&&&&&sqlnet.expire_time&的原理:Oracle
Server&发送包探测dead connection&,如果连接关闭,或者不再用,则关闭相应的server
Limitations on using this terminated connection
detection feature are:
(1)It is not allowed on bequeathed connections.
(2)Though very small, a probe packet generates additional
traffic that may downgrade network performance.
(3)Depending on which operating system is in use, the
server may need to perform additional processing to distinguish the connection probing event from other events that occur. This can also result in degraded network performance.
Default&:0
Minimum Value&:0
Recommended Value&:10
SQLNET.EXPIRE_TIME=10
2.2&设置用户profile的&参数
&&&&&&&&&&&
之前整理的一篇有关profile的文章:
&&&&&&&&&&&&Oracle&用户&profile&属性
&&&&&&&&&&&&
&&&&&&&&&&&&注意,要启用idle_time&要先启用RESOURCE_LIMIT参数。&该参数默认是False。&官网说明如下:
RESOURCE_LIMIT
Description
Parameter type
Default value
Modifiable
ALTER SYSTEM
Range of values
true | false
&&&&&&&&&&&&RESOURCE_LIMIT
determines whether resource limits are enforced in database profiles.
&&&&&&&&&&&&TRUE:&Enables the enforcement of resource
&&&&&&&&&&&&FALSE:Disables the enforcement of resource limits
如下blog&在这块说的比较清楚,并提供了相关的脚本:
&&&&&&&&&&&&sqlnet.expire_time and IDLE_TIME
&&&&&&&&&&&&
&&&&&&&&&&&&IDLE_TIME Specify the permitted periods of continuous inactive time during a session,&expressed
in minutes. Long-running queries and other operations are not subject to this limit.
&&&&&&&&&&&&A valid database connection that is idle will respond to the probe packet causing no action on the part of the Server
,whereas the resource_limit will snipe the session when idle_time is exceeded.&The 'sniped' session will get disconnected when the user(or the user process) tries to communicate with the server
&&&&&&&&&&&
&&&&&&&&&&&&--&通过idle_time限制session
idle&时间。session idle超过设置时间,状态为sniped (v$session).,然而OS下的process并不会释放,当session(user
process)&再次与server process&通讯,将关闭相应的server process.
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.
修改示例:
SQL&alter profile default limit idle_time 10;
--需要重启下oracle
查询应用的连接数SQL:
/* Formatted on
13:06:23 (QP5 v5.163.) */
&&SELECT&b.MACHINE,&b.PROGRAM,&COUNT&(*)
&&&&FROM&v$process&a,&v$session
&&&WHERE&a.ADDR&=&b.PADDR&AND&b.USERNAME&IS&NOT&NULL
GROUP&BY&b.MACHINE,&b.PROGRAM
ORDER&BY&COUNT&(*)&DESC;
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:871302次
积分:10674
积分:10674
排名:第1258名
原创:198篇
转载:233篇
评论:51条
(1)(1)(2)(5)(2)(1)(7)(1)(1)(7)(5)(12)(5)(6)(8)(3)(3)(3)(8)(1)(1)(20)(1)(1)(12)(6)(15)(7)(12)(5)(3)(14)(12)(1)(5)(3)(2)(13)(7)(10)(10)(24)(3)(12)(5)(5)(4)(42)(3)(6)(85)session 和connection的不同 - zzwssfd - ITeye技术网站
博客分类:
session 和connection的不同
这里的不同,主要讨论dedicated server下的不同,为讨论shared server情况下的。参考资料是TOM的《oracle编程艺术9i,10g,11g》
一个connection可能没有session建立在上面,也可能有一个、甚至多个session建立在connection上,并且每个session都是分割开的、独立的,即使他们共享数据库的physical connection。一个connection中的某个session的提交动作不会影响到其他session。
在oracle中,connection是在用户进程和数据库实例中间的一个简单的物理回路-----也可以说是网络连接。这个connection可能是连接到dedicated server process或者连接到一个dispatcher。session可能建立在connection上,也可能不在connection上。在使用advanced Oracle Net features时,如connection pooling,物理connection可能被客户端丢弃,留下session未动,空闲状态。当客户端想在这个session中执行一些操作时,oracle会重建这个物理connection。
connection:是客户端到oracle实例的物理路径(在客户端进程和dedicated server 或dispatcher)。connection建立在network或者IPC 进程上。然而,如果使用Oracle的connection manager(CMAN),connection就可能建立在客户端和CMAN,CMAN和数据库间。注意:这里的connection是分两段的。一段是,客户端和CMAN,第二段是,CMAN和数据库间。
session:是存在于instance中的逻辑entity(存在、实体)。
使用SQL*Plus 来看看实际中的connection和session。通过AUTOTRACE命令来验证一个connection中可以有多个session。
这个sql显示当前系统中只有一个session:一个单一的dedicated server-connection session。PADDR列是dedicated server的进程号。下面打开AUTOTRACE。
这样就得到两个session,这两个都是用相同的dedicated server 进程,可见这两个session的PADDR的值是相同的。值得注意的是STATUS是ACTIVE的session,这个session就是执行上面那个sql的session。但是INACTIVE的session是哪个?它是AUTOTRACE session。AUTOTRACE的工作是监视用户的real session,并且给出real session的工作报告。
AUTOTRACE在SQL*Plus中被激活后,当用户自行DML操作(INSERT, DELETE, SELECT,MERGE)时,SQL*Plus会执行下面动作:
1,SQL*Plus会在当前的connection中创建一个新的session;
2,SQL*Plus会让这个新的session查询V$SESSTAT来得到执行DML操作的session的初始统计信息。
3,SQL*Plus在原始的session中执行DML操作
4,DML操作完成后,SQL*Plus会请求AUTOTRACE session再次查询V$SESSTAT,计算出执行DML操作的
session在执行DML操作前后的统计信息。
关闭AUTOTRACE后,SQL*Plus会关闭这个session,并且在V$SESSION中看不到这个session。oracle为何在同一个connection中新建一个session。因为,如果在额外的connection中建立一个session,那么AUTOTRAEC统计出的信息就不准确了。
以上是在一个connection中建立2个session。下面是使用SQL*Plus,来看看connection中没有session的情况。使用DISCONNECT命令即可。
在一个窗口中执行disconnect
这个命令并没有物理关闭connection,但是关闭了所有的session。如果在另一个窗口中使用其他用户登录、查询。
这里用u1登录,u1有dba权限。用u1用户去查询和SYS用户相关的session信息。结果可以发现,在disconnect之后,和SYS用户相关的session信息全部丢失。
下面接着查看之前SYS用户的session所在的connection是否还存在。这个connection的ADDR是 ‘2E3C2B84’
这里可以发现这个进程并未消失。
在以前的窗口重新连接SYS用户:connect /
可以看见重新连进来以后的ADDR还是‘2E3C2B84’,但是SID不一样了。这个SID和之前的不一样,是因为在SYS帐号disconnect期间,有其他人在别处使用SYS帐号登录过。
浏览: 38748 次当前位置: &
user session中文是什么意思
中文翻译用户会话&&&&n. 【法律】(财产等的)使用(权),行使(权),享受( ...&&&&n. 1.会议;会议的一次[一届];开会;(法庭的)开庭 ...&&&&端点用户到端点用户对话&&&&被叫会晤层用户&&&&会晤用户数据&&&&在开会;在开庭; 在开庭&&&&会议期间&&&&休会期间&&&&n. 1.会议;会议的一次[一届];开会;(法庭的)开庭。 2.开会期;开庭期。 3.〔美, Scot.〕学期。 4.〔美国〕授课时间。 5.〔pl.〕〔英 ...&&&&用户不存在&&&&此种方案; 该用户; 这个使用者; 指定用户&&&&n. 1.使用者,用户。 2.吸毒成瘾者。
U- pays. 使用者须付费〔指由政府出资提供公用设施,但使用者须付费〕。 n. 【法律】(财产等 ...&&&&新学期&&&&大会总结&&&&工作时间; 有效对话期间; 有效时间&&&&增开会议&&&&午后的行市, 后市; 午市; 下午班&&&&打开并添加到当前任务&&&&美国国会的秋季会议&&&&批量对话; 整批处理时间&&&&请参阅绑定会话&&&&献计献策会,思维碰撞会,集体讨论会&&&&简报会;简介会; 简要情况介绍会&&&&大型会议; 闲谈&&&&〔美俚〕自由讨论。
例句与用法The spid provides the reference to the user sessionSpid提供对用户会话的引用。 The number of currently active user sessions当前处于活动状态的用户会话的数目。 Session the request is owned by a user sessionSession =请求由用户会话所有。 Provides information to the current user session为当前用户会话提供信息。 User sessions are not affected by role assignment changes角色分配的更改不会影响用户会话。 The user is logging off and ending the current user session用户正在注销并结束当前用户会话。 In those cases the user session is prevented from completely ending在这些情况下,用户会话无法彻底结束。 To save information about a user session across multiple requests来跨越多个请求保存有关用户会话的信息。 Is available , the service implementation can retrieve the user session data from the可用,服务实现就能够从Asp . net provides two events that help you manage user sessions : theAsp . net提供两个有助于管理用户会话的事件: 更多例句:&&1&&&&&&&&&&
相邻词汇热门词汇
user session的中文翻译,user session是什么意思,怎么用汉语翻译user session,user session的中文意思,发音,例句,用法和解释由查查在线词典提供,版权所有违者必究。
&&&&&&&&&&&&&&&&
Copyright &
(京ICP备号)
All rights reservedASH(Active Session History)-提供留学,移民,理财,培训,美容,整形,高考,外汇,印刷,健康,建材等信息_突袭网
当前位置&:&&&&ASH(Active Session History)
热门标签:&
ASH(Active Session History)
来源: 由用户
编辑:王亮
ASH(Active Session
History)从Oracle10g开始引入了V$ACTIVE_SESSION_HISTORY视图,用于查询用户活动会话的历史信息。ASH每秒采样V$session,记录会话等待的事件,不活动的会话不会被采样。这个采样工具是非常有效的,因为它直接访问oracle10g内部结构。ASH缺省每一秒收集一下活动会话的情况,间隔时间由
_ash_sampling_interval
参数确定。由于数据量巨大,把所有的ASH数据写到磁盘上是不可接受的。通常每60分钟MMON进程会写这些信息,当ASH
BUFFER满的话MMNL进程会写。SQL& select * from v$sgastat where name like
'%ASH%';POOL&&&&&&&& NAME&&&&&&&&&&&&&&&&&&&&&&&&&&& BYTES------------
-------------------------- ----------shared pool ASH
buffers&&&&&&&&&&&&&&&&&& 6291456注意,ASH buffers的大小按照以下算法分配:
Min(shared_pool_size*5%,2M*cpu_count)V$ACTIVE_SESSION_HISTORY中的数据在被新数据周期性地覆盖前保留30
分钟,当数据从这个动态性能视图中清除时,这些数据被送到活动工作负载信息库(Active Workload
Repository,AWR)中,它是一个基于磁盘的信息库。被清除的ASH(活动会话历史)数据可以在 DBA_HIST_ACTIVE_SESSION_HIST
视图中看到,能够看到过去的会话的等待事件,在默认状态下,AWR中的数据7天后即被清除。V$ACTIVE_SESSION_HISTORY包含top
wait events, top SQL, top SQL command types,top
sessions等等对于诊断故障非常有用的信息。V$ACTIVE_SESSION_HISTORY是生成ASH报表的来源,可以通过OEM来生成report,也可以通过Oracle新提供的一个脚本来完成这个工作,执行脚本:SQL&
@?/rdbms/admin/ashrpt.sql输入 report_type 的值: &enter默认html格式&输入
begin_time 的值: -30&&& (查询过去半小时内的session情况)输入 duration 的值:
&enter默认到目前位置&输入 report_name 的值: &enter默认指定的报告名字&Report
written to ashrpt_1_.html下载ashrpt_1_.html文件并查看分析。
更多精彩 >>>}

我要回帖

更多关于 activemq session参数 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信