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

简介: 【sessions】Oracle中sessions和processes的大小关系(10g和11g不同) 1  BLOG文档结构图 BLOG_Oracle_lhr_【sessions】Oracle中sessions和processes的大小关系(10g和11g不同).


sessionsOraclesessions和processes的大小关系(10g和11g不同)

1  BLOG文档结构图



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

2  前言部分

2.1  导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~

① sessionsprocesses的大小设置,10g和11g不同(重点)

  Tips

本文在itpubhttp://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的最大归档日志号为33thread 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  sessionprocess的设置关系

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

...............................................................................................................................

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

本文在itpubhttp://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和个人微信公众号(xiaomaimiaolhr)上有同步更新

本文itpub地址:http://blog.itpub.net/26736162/viewspace-2126128/

本文博客园地址:http://www.cnblogs.com/lhrbest/articles/5950987.html

本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b

小麦苗云盘地址:http://blog.itpub.net/26736162/viewspace-1624453/

● QQ群:230161599     微信群:私聊

联系我请加QQ好友(642808185),注明添加缘由

2016-10-10 10:00 ~ 2016-10-11 19:00 在中行完成

文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解!

【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】

...............................................................................................................................

手机长按下图识别二维码或微信客户端扫描下边的二维码来关注小麦苗的微信公众号:xiaomaimiaolhr,免费学习最实用的数据库技术。

wps9F08.tmp


目录
相关文章
|
4月前
|
Oracle 关系型数据库 数据库
使用docker安装配置oracle 11g
使用docker安装配置oracle 11g
|
6月前
|
Oracle 关系型数据库 数据库
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
|
1月前
|
存储 Oracle 关系型数据库
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
|
4月前
|
SQL Oracle 关系型数据库
docker 方式安装ORACLE 11g
docker 方式安装ORACLE 11g
198 4
|
5月前
|
Oracle 关系型数据库 数据库
在Flink CDC中,使用Oracle 11g数据库的NUMBER类型作为主键
在Flink CDC中,使用Oracle 11g数据库的NUMBER类型作为主键
48 1
|
5月前
|
SQL Oracle 安全
window下Oracle 11G安装文档
window下Oracle 11G安装文档
|
7月前
|
Oracle 关系型数据库
Oracle 11g和12c的主要区别
Oracle 11g和12c的主要区别
|
9月前
|
Oracle 关系型数据库 数据库连接
Oracle 11g安装配置完美教程 - Windows(下)
Oracle 11g安装配置完美教程 - Windows(下)
154 0
|
9月前
|
SQL Oracle 安全
Oracle 11g安装配置完美教程 - Windows(上)
Oracle 11g安装配置完美教程 - Windows
713 0
|
11月前
|
SQL Oracle 关系型数据库
Oracle 11g安装使用、备份恢复并与SpringBoot集成
Oracle 11g安装使用、备份恢复并与SpringBoot集成
302 0

推荐镜像

更多