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

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.

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31448824/viewspace-2139348/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31448824/viewspace-2139348/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值