背景
前段时间有天,发现有大量的Oracle sqlplus 任务连接失败而导致job 大批量报错,重新调起后,运行一会又会报出同样的错误信息。后来发现系Oracle session 数太多所致,超过设定的process 数量而被数据库拒绝导致连接失败。
错误代码
ERROR:
ORA-12520: TNS:listener could not find available handler for requested type of server
ERROR:
ORA-12516: TNS:listener could not find available handler with matching protocol stack
解决方案
查看当前连接数,发现一直在最大连接数左右徘徊,遂推测是连接大于最大连接数所致。修改Oracle process 参数,扩大processs 的value 值。重启数据库,然后新的session 连接成功。
查看当前连接数:
SQL> select count(*) from v$process;
COUNT(*)
----------
994
查看 process 值(最大连接数)
SQL> show parameter process
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 1
cell_offload_processing boolean TRUE
db_writer_processes integer 8
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 10
log_archive_max_processes integer 4
processes integer 1500
processor_group_name string
也可以用以下方法查看:
select *
from v$parameter
where name = 'processes'
修改最大连接数,并重启数据库后生效。
SQL>alter system set processes=2000 scope=spfile;