oracle最大连接数导致应用挂掉

配置keepalive+nginx高可用的时候,启动了应用,发现连接到后台的数据库报错:

Caused by: java.sql.SQLRecoverableException: IO 错误: Socket read timed out
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310)

使用pl/sql打开数据库发现连接不上,然后直接登录服务器检查:

[oracle@abc ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 17 14:28:58 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-09817: Write to audit file failed.
Linux-x86_64 Error: 28: No space left on device
Additional information: 12
ORA-01075: you are currently logged on

发现报错:ORA-09817: Write to audit file failed.

另外有:ORA-01075: you are currently logged on

直接百度:发现ORA-01075是因为达到了最大连接数,那就直接简单粗暴:http://blog.itpub.net/29067253/viewspace-2145070/

$ ps -ef |grep $ORACLE_SID|grep -v grep|awk '{print $2}' | xargs kill -9
$ ipcs -m | grep oracle | awk '{print $2}' | xargs ipcrm shm

生产数据库千万别自己乱动!!!

然后登陆仍然报错:

[oracle@abc ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 17 14:35:55 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-09817: Write to audit file failed.
Linux-x86_64 Error: 28: No space left on device
Additional information: 12
ORA-09945: Unable to initialize the audit trail file
Linux-x86_64 Error: 28: No space left on device

没空间了:

[oracle@abc ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        30G  9.3G   19G  33% /
tmpfs            16G  3.1G   13G  20% /dev/shm
/dev/vdb        197G  197G     0 100% /home
[oracle@abc ~]$ cd /home/

删除对应的日志文件,删除之后发现空间并未释放:

使用:lsof |grep delete,找到对应的进程杀掉就好了

(其实直接找产生日志的进程,然后重启下就好了,不用lsof |grep delete)

原文地址:https://www.cnblogs.com/wjlv/p/10723583.html