这两个参数是我们学习数据库时首先遇到的几个参数之一。在Oracle的官方文档中,其解释如下:
PROCESSES specifies the maximum number of operating system user processes that can simultaneously connect to Oracle. Its value should allow for all background processes such as locks, job queue processes, and parallel execution processes.
简单的说,该参数实际上是指定了一个上限值,其在生产系统中的含义是:
该系统所允许的最大用户并发访问数量。
当然我们要注意最后一句话,这个值,包含了所有的系统后台进程和并行进程。
那么,当前系统有多少个后台进程,在os上用ps -ef|grep ora_就可以查出来了,在db中使用动态视图也可以。
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.
session是基于process而创立,一个process上可以有一个或者多个session。比如,如果我们在一个用户连接上开启跟踪,然后再执行正常的sql命令,那么这个连接上就同时有两个会话了。
sessions参数依赖于processes产生的设置,其关系如下:
sessions = ( 1.5 * PROCESSES) + 22
在12c中,这两个值分别为300和472。
而在11.2版本中,processes默认值则为150。恩,这种变化趋势,我们也是预料得到的。
但是在实际使用这两个参数时,我们则不需要在每次设置的时候,都严格根据processes来计算出sessions的值。如下:
SYS@cdb12c> alter system set processes=400 scope=spfile;
System altered.
SYS@cdb12c> alter system set sessions=500 scope=spfile;
System altered.
SYS@cdb12c> startup force;
ORACLE instance started.
Total System Global Area 838860800 bytes
Fixed Size 2929936 bytes
Variable Size 629148400 bytes
Database Buffers 201326592 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
SYS@cdb12c> show parameter processes;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 1
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 400
SYS@cdb12c> show parameter sessions;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
sessions integer 622
shared_server_sessions integer
oracle会自动基于processes完成sessions参数的调整。