Oracle 参数 SESSIONS 官方解释,作用,如何配置最优化建议
本站中文解释
SESSIONS:用于控制当前数据库处理的最大会话(登录)数。它可以限制当前数据库的最大用户数量,避免系统处理过多的用户从而导致泄漏资源。
如何正确设置:
1.首先,应该确定允许的最大登录会话数,这要根据你系统运行所需要的资源来定,在Oracle数据库中使用如下命令来设置:alter system set sessions=N; 其中N是你希望允许的最大登录会话数。
2.其次,为避免出现ORA-00020错误,可以调整processes参数来控制进程数,设置如下:alter system set processes=N; 其中N是当前允许的最大登录会话数的两倍
3.最后,要注意的是,全局数据库的默认sessions和processes参数的配置不应超过服务器的资源,否则可能导致系统出现崩溃、基础环境破坏等后果。
官方英文解释
SESSIONS
specifies the maximum number of sessions that can be created in the system.
Property | Description |
---|---|
Parameter type |
Integer |
Default value |
Derived: (1.5 * |
Modifiable |
|
Modifiable in a PDB |
Yes |
Range of values |
1 to 216 (which is 1 to 65536) |
Basic |
Yes |
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.
For a CDB, the root container’s SESSIONS
parameter specifies the total number of sessions for the database.
The SESSIONS
parameter for a PDB specifies the total number of sessions that can be used by that PDB. Its value defaults to the root container’s SESSIONS
value. If the PDB tries to use more sessions than configured by its SESSIONS
parameter, an ORA-00018
error message is generated. For PDBs, the SESSIONS parameter does not count recursive sessions and hence does not require the 10% adjustment.
The SESSIONS
parameter for a PDB can only be modified by the PDB. It cannot be set higher than the CDB’s SESSIONS
value.
See Also:
-
Oracle Database
Concepts for more information on memory structures -
Oracle Database
Concepts for more information on processes -
Oracle Multitenant
Administrator’s Guide for more information about CDBs and PDBs