OERR: ORA-12519 TNS:no appropriate service handler found

客户端连接间歇性失败,报错ORA-12519

Cause: the listener could not find any available service handlers that are 
       appropriate for the client connection.

Action:  检查lsnrctl service ,instance已经注册,状态显示ready时,可以连接。

When the listener believes the current number of connections has reached maximum load, 
it may set the state of the service handler for an instance to "blocked" and begin refusing 
incoming client connections with either of the following errors: ora-12519 or ora-12516

采用服务动态注册的方式,由PMON 通过SERVICE_UPDATE 来得到目前连接情况,但SERVICE_UPDATE 有时间间隔,
所以,listener显示的连接数和当前实际的连接数可能不同。

具体解决方案如下:

--首先检查process和session的使用情况,在sqlplus里面查看。

SQL> show parameter processes

NAME                         TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     6
gcs_server_processes                 integer     0
job_queue_processes                  integer     0
log_archive_max_processes            integer     2
processes                    integer     150

SQL> select count(*) from v$process;

  COUNT(*)
----------
       147

--明显process已经几乎达到了顶峰。

 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
logmnr_max_persistent_sessions       integer     1
session_cached_cursors               integer     20
session_max_open_files               integer     10
sessions                     integer     160

shared_server_sessions               integer
SQL>

 SQL> select count(*) from v$session;

  COUNT(*)
----------
        153

--同样几乎达到顶峰。

 --修改oracle的process和session值,加大他们最大连接数。

--oracle文档要求,SESSIONSTRANSACTIONS的初始化参数应该源于PROCESSES参数,根据默认设置SESSIONS = PROCESSES * 1.1 + 5

 SQL> alter system set processes=300 scope=spfile;

System altered.

SQL> alter system set sessions=335 scope=spfile;

System altered.

 --重启数据库后参数修改完成

SQL> shutdown      --如果长时间没反应可能是连接请求没又关闭,也可以使用  abort参数直接关闭

SQL> startup         --可以用 force参数   关闭当前运行数据库后正常启动。