告警短信:can't connect DB,maybe down!,TNS-12520,TNS-12519,TNS-12516
SQL> select name,value from v$spparameter where name in('sessions','processes');
NAME VALUE
-------------------- ------
processes 500
sessions 555
SQL> select count(*) from v$process;
COUNT(*)
----------
495
SQL> select count(*) from v$session;
COUNT(*)
----------
481
至于为什么会报这样的错误,以及实际的process数量并没有达到500,但是应用无法连接,看如下的Metalink解释:
instance registration, PMON is responsible for updating the listener with information about a particular instance such as load and dispatcher information. Maximum load for dedicated connections is determined by the PROCESSES parameter. The frequency at which PMON provides SERVICE_UPDATE information varies according to the workload of the instance. The maximum interval between these service updates is 10 minutes.
The listener counts the number of connections it has established to the instance but does not immediately get information about connections that have terminated.
Only when PMON updates the listener via SERVICE_UPDATE is the listener informed of current load. Since this can take as long as 10 minutes, there can be a difference between the current instance load according to the listener and the actual instance load.
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:
TNS-12516 TNS:listener could not find instance with matching protocol stack
TNS-12519 TNS:no appropriate service handler found
Additionally, an ORA-12520 error may appear in the listener log. The output of the LSNRCTL services command will likely show that the service handler is "blocked".
e.g. '"DEDICATED" established:1 refused:0 state:blocked'
在listener log里面发现如下信息:
10-JUL-2012 14:14:27 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58503)) * establish * xxx * 0
10-JUL-2012 14:14:37 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58632)) * establish * xxx * 0
10-JUL-2012 14:14:37 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))(SERVER=dedicated)) * (ADDRESS=(PR
OTOCOL=tcp)(HOST=10.10.41.125)(PORT=58640)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:14:37 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58641)) * establish * xxx * 0
10-JUL-2012 14:14:37 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))(SERVER=dedicated)) * (ADDRESS=(PR
OTOCOL=tcp)(HOST=10.10.41.125)(PORT=58642)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:14:43 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=cmg))(SERVICE_NAME=xxx)(FAILOVER_MODE=(TYPE=SELECT)(MET
HOD=BASIC)(RETRIES=20)(DELAY=10))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.710.233.38)(PORT=50144)) * establish * xxx * 12516
TNS-12516: TNS:listener could not find available handler with matching protocol stack
10-JUL-2012 14:14:46 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=pss_tuner.9i)(HOST=host1)(USER=prec))) * (ADDRESS=(PROTOCOL=tcp)
(HOST=10.10.41.125)(PORT=58720)) * establish * xxx * 0
10-JUL-2012 14:14:46 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=pss_tuner.9i)(HOST=host1)(USER=prec))(SERVER=dedicated)) * (ADDR
ESS=(PROTOCOL=tcp)(HOST=10.10.41.125)(PORT=58721)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:14:47 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58726)) * establish * xxx * 0
10-JUL-2012 14:14:47 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))(SERVER=dedicated)) * (ADDRESS=(PR
OTOCOL=tcp)(HOST=10.10.41.125)(PORT=58734)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:14:47 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58735)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:14:57 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58985)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:14:57 * (CONNECT_DATA=(SID=xxx)(CID=(PROGRAM=oracle)(HOST=host1)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=1
0.70.213.215)(PORT=58993)) * establish * xxx * 12519
TNS-12519: TNS:no appropriate service handler found
10-JUL-2012 14:15:01 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ebusi)(INSTANCE_NAME=xxx)(CID=(PROGRAM=db2.pl)(HOST=zjdaov
01)(USER=yiyang))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.70.240.82)(PORT=49245)) * establish * xxx * 12520
TNS-12520: TNS:listener could not find available handler for requested type of server
10-JUL-2012 14:15:02 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=cmg))(SERVICE_NAME=xxx)(FAILOVER_MODE=(TYPE=SELECT)(MET
HOD=BASIC)(RETRIES=20)(DELAY=10))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.70.203.7)(PORT=59045)) * establish * xxx * 12516
TNS-12516: TNS:listener could not find available handler with matching protocol stack
这个问题之前遇到过,看了下如下参数的值:
SQL> select name,value from v$spparameter where name in('sessions','processes');
NAME VALUE
-------------------- ------
processes 500
sessions 555
SQL> select count(*) from v$process;
COUNT(*)
----------
495
SQL> select count(*) from v$session;
COUNT(*)
----------
481
至于为什么会报这样的错误,以及实际的process数量并没有达到500,但是应用无法连接,看如下的Metalink解释:
instance registration, PMON is responsible for updating the listener with information about a particular instance such as load and dispatcher information. Maximum load for dedicated connections is determined by the PROCESSES parameter. The frequency at which PMON provides SERVICE_UPDATE information varies according to the workload of the instance. The maximum interval between these service updates is 10 minutes.
The listener counts the number of connections it has established to the instance but does not immediately get information about connections that have terminated.
Only when PMON updates the listener via SERVICE_UPDATE is the listener informed of current load. Since this can take as long as 10 minutes, there can be a difference between the current instance load according to the listener and the actual instance load.
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:
TNS-12516 TNS:listener could not find instance with matching protocol stack
TNS-12519 TNS:no appropriate service handler found
Additionally, an ORA-12520 error may appear in the listener log. The output of the LSNRCTL services command will likely show that the service handler is "blocked".
e.g. '"DEDICATED" established:1 refused:0 state:blocked'