Oracle processes和sessions参数(进程连接数&会话连接数)
如果配置过小,连接时可能会报错:ORA-12519, TNS:no appropriate service handler found
Oracle官方建议 sessions = process * 1.1 + 5
查看process和session:
show parameter process;
show parameter session;
查看数据库进程的连接数配置:
show parameter process;
或
select value from v$parameter where name = 'processes';
查看数据库当前进程的连接数:
select count(*) from v$process;
查看数据库会话的连接数配置参数
show parameter session;
或
select value from v$parameter where name = 'sessions';
查看数据库当前会话的连接数:
select count(*) from v$session;
查看数据库的并发连接数:
select count(*) from v$session where status='ACTIVE';
查看当前数据库建立的会话详情:
select sid,serial#,username,program,machine,status from v$session;
默认值如下:
SQL> show parameter process;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
cell_offload_processing boolean TRUE
db_writer_processes integer 4
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 150
SQL>
SQL> show parameter session;
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
session_cached_cursors integer 50
session_max_open_files integer 10
sessions integer 256
shared_server_sessions integer
SQL>
修改process和session配置
先查看数据库是spfile还是pfile启动:
show parameter spfile -- 有值则为spfile
修改process和session
alter system set processes=500 scope=spfile;
alter system set sessions=555 scope=spfile;
重启生效:
shutdown immediate;
startup;
show parameter process;
show parameter session;
修改后实际生效的session数比设置的大,原因没有细研究
SQL> show parameter process;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
cell_offload_processing boolean TRUE
db_writer_processes integer 4
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 500
SQL> show parameter session;
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
session_cached_cursors integer 50
session_max_open_files integer 10
sessions integer 800
shared_server_sessions integer
SQL>