ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

【sessions】Oracle中sessions和processes的大小关系(10g和11g不同)

2021-04-09 21:53:16  阅读:174  来源: 互联网

标签:processes NAME sessions 10g SYS lhrdb ----------


【sessions】Oracle中sessions和processes的大小关系(10g和11g不同)

1  BLOG文档结构图

wpsDCA9.tmp_thumb[1]

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的值

从官方文档我们可以查询到以下的信息:

wps4C1D.tmp_thumb[1]

 

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.

 


标签:processes,NAME,sessions,10g,SYS,lhrdb,----------
来源: https://blog.51cto.com/lhrbest/2695405

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有