oracle 连接超时问题处理

集群中有模块提示连接超时。

分析排查

看日志

提示信息:
connection time out
说明很可能是数据库连接池满了。

用工具连下数据库,连不上说明满了

连了一下发现果然连不上。是数据库满了。

sql查看连接数

select value from v$parameter where name ='processes'; -- 最大连接数
select count(*) from v$process;  -- 当前连接数

解决方案

sql解决方案

找dba查看链接情况。 停掉一些影响较小的链接。
这种方法不一定有效,因为查了下,session并不多,但是数据库确实爆了。

查看机器用户的链接数:

select username , count(*), machine from v$session where username is not null group by  username, machine order by username;

查看连接的sid和serial#:

select SID,SERIAL#,username , count(*), machine from v$session where username is not null group by  SID,SERIAL#,username, machine order by username;

杀掉session:

alter system kill session '741,12797';

配置和代码解决方案

1、调整配置文件中的连接数,以及超时释放时间。
2、调整数据库集群支持的链接数。
3、查找代码中,链接泄露的代码。

其他可能和连接池有关的报错

# 报错一:
java.io.IOException: UT010029: Stream is closed
# 报错二:
raised exception errcode [-1] errmsg [Broken pipe] stack[{}]

你可能感兴趣的:(java)