【sessions】Oracle中sessions和processes的大小关系(10g和11g不同)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了【sessions】Oracle中sessions和processes的大小关系(10g和11g不同),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含6701字,纯文字阅读大概需要10分钟。
内容图文
![【sessions】Oracle中sessions和processes的大小关系(10g和11g不同)](/upload/InfoBanner/zyjiaocheng/860/9717792014614d0e9c58558f6ab4894a.jpg)
1 BLOG文档结构图
2 前言部分
2.1 导读和注意事项
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
① sessions和processes的大小设置,10g和11g不同(重点)
Tips:
① 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和微信公众号(xiaomaimiaolhr)有同步更新。
② 文章中用到的所有代码,相关软件,相关资料请前往小麦苗的云盘下载(http://blog.itpub.net/26736162/viewspace-1624453/)。
③ 若网页文章代码格式有错乱,推荐使用360浏览器,也可以下载pdf格式的文档来查看,pdf文档下载地址:http://blog.itpub.net/26736162/viewspace-1624453/,另外itpub格式显示有问题,也可以去博客园地址阅读。
④ 本篇BLOG中命令的输出部分需要特别关注的地方我都用灰色背景和粉红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33,thread 2的最大归档日志号为43是需要特别关注的地方;而命令一般使用黄色背景和红色字体标注;对代码或代码输出部分的注释一般采用蓝色字体表示。
List of Archived Logs in backup set 11 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48 1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58 2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49 2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53 [ZHLHRDB1:root]:/>lsvg -o T_XLHRD_APP1_vg rootvg [ZHLHRDB1:root]:/> 00:27:22 SQL> alter tablespace idxtbs read write; ====》2097152*512/1024/1024/1024=1G |
本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。
3 session与process的设置关系
session:指定了一个实例中允许的会话数,即能同时登录到数据库的并发用户数。
process: 指定了一个实例在操作系统级别能同时运行的进程数,包括后台进程与服务器进程。
由上面的分析可知,一个后台进程可能同时对应对个会话,因此通常sessions的值是大于processes的值
从官方文档我们可以查询到以下的信息:
Property | Oracle 10g | Oracle 11g |
Parameter type | Integer | Integer |
Default value | Derived: (1.1 * PROCESSES) + 5 | Derived: (1.5 * PROCESSES) + 22 |
Modifiable | No | No |
Range of values | 1 to 231 | 1 to 216 (which is 1 to 65536) |
Basic | Yes | Yes |
SESSIONS specifies the maximum number of sessions that can be created in the system. Because every login requires a session, this parameter effectively determines the maximum number of concurrent users in the system. You should always set this parameter explicitly to a value equivalent to your estimate of the maximum number of concurrent users, plus the number of background processes, plus approximately 10% for recursive sessions.
Oracle uses the default value of this parameter as its minimum. Values between 1 and the default do not trigger errors, but Oracle ignores them and uses the default instead.
The default values of the ENQUEUE_RESOURCES and TRANSACTIONS parameters are derived from SESSIONS. Therefore, if you increase the value of SESSIONS, you should consider whether to adjust the values of ENQUEUE_RESOURCES and TRANSACTIONS as well. (Note that ENQUEUE_RESOURCES is obsolete as of Oracle Database 10g release 2 (10.2).)
In a shared server environment, the value of PROCESSES can be quite small. Therefore, Oracle recommends that you adjust the value of SESSIONS to approximately 1.1 * total number of connections.
3.1 结论
1. sessions的值是根据processes的值计算得到的,一般情况下只需要设置processes的值即可。
2. 在Oracle 10g中,sessions大小的的计算公式为:(1.1 * PROCESSES) + 5;在Oracle 11g中,sessions大小的的计算公式为:(1.5 * PROCESSES) + 22。
3. 若sessions的当前值比计算值大的话,则sessions的值可能保持不变;若sessions的当前值比计算值小的话,则sessions取计算值,即sessions的值总是取MAX(当前值,计算值),但是这个也不是绝对的。
3.2 实验
SYS@lhrdb> COL NAME FORMAT A10 SYS@lhrdb> COL VALUE FORMAT A10 SYS@lhrdb> SELECT A.NAME, A.VALUE 2 FROM V$PARAMETER A 3 WHERE A.NAME IN ('processes', 'sessions');
NAME VALUE ---------- ---------- processes 100 sessions 176
SYS@lhrdb> alter system set processes=200 scope=spfile;
System altered.
SYS@lhrdb> STARTUP FORCE ORACLE instance started.
Total System Global Area 1720328192 bytes Fixed Size 2247072 bytes Variable Size 503318112 bytes Database Buffers 1207959552 bytes Redo Buffers 6803456 bytes Database mounted. Database opened. SYS@lhrdb> SELECT A.NAME, A.VALUE 2 FROM V$PARAMETER A 3 WHERE A.NAME IN ('processes', 'sessions');
NAME VALUE ---------- ---------- processes 200 sessions 328
SYS@lhrdb> SYS@lhrdb> alter system set processes=50 scope=spfile;
System altered.
SYS@lhrdb> STARTUP FORCE ORACLE instance started.
Total System Global Area 1720328192 bytes Fixed Size 2247072 bytes Variable Size 503318112 bytes Database Buffers 1207959552 bytes Redo Buffers 6803456 bytes Database mounted. Database opened. SYS@lhrdb> SELECT A.NAME, A.VALUE 2 FROM V$PARAMETER A 3 WHERE A.NAME IN ('processes', 'sessions');
NAME VALUE ---------- ---------- processes 50 sessions 176
SYS@lhrdb> SYS@lhrdb> alter system set processes=60 scope=spfile;
System altered.
SYS@lhrdb> STARTUP FORCE ORACLE instance started.
Total System Global Area 1720328192 bytes Fixed Size 2247072 bytes Variable Size 452986464 bytes Database Buffers 1258291200 bytes Redo Buffers 6803456 bytes Database mounted. Database opened. SYS@lhrdb> SELECT A.NAME, A.VALUE 2 FROM V$PARAMETER A 3 WHERE A.NAME IN ('processes', 'sessions');
NAME VALUE ---------- ---------- processes 60 sessions 176 |
3.3 报错信息
当数据库连接的并发用户已经达到这个值时,又有新session连进来,就会报错
ORA-00018,"maximum number of sessions exceeded"
当Oracle需要启动新的process而又已经达到processes参数时,就会报错:
ORA-00020: maximum number of processes (2048) exceeded
如果数据库上连接被占用完,新的连接过来时,会在客户端产生:"ORA-12519, TNS:no appropriate service handler found "的报错信息.
[ZFLHRDB2:oracle]:/oracle>oerr ora 12519 12519, 00000, "TNS:no appropriate service handler found" // *Cause: The listener could not find any available service handlers that // are appropriate for the client connection. // *Action: Run "lsnrctl services" to ensure that the instance(s) have // registered with the listener, and are accepting connections. [ZFLHRDB2:oracle]:/oracle>oerr ora 20 00020, 00000, "maximum number of processes (%s) exceeded" // *Cause: All process state objects are in use. // *Action: Increase the value of the PROCESSES initialization parameter. [ZFLHRDB2:oracle]:/oracle>oerr ora 18 00018, 00000, "maximum number of sessions exceeded" // *Cause: All session state objects are in use. // *Action: Increase the value of the SESSIONS initialization parameter. |
About Me
内容总结
以上是互联网集市为您收集整理的【sessions】Oracle中sessions和processes的大小关系(10g和11g不同)全部内容,希望文章能够帮你解决【sessions】Oracle中sessions和processes的大小关系(10g和11g不同)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。