数据库连接过多问题
来源:互联网 发布:能看电视的软件 编辑:程序博客网 时间:2024/05/02 19:31
最近线上不断爆出数据库连接超时,表现
1.应用无法连接数据库
2.日志中c3p0不断报出time out
排查:
检查数据库中是否有过多sql语句,没有发现问题。
select sq.SQL_TEXT from v$open_cursor oc, v$sql sq, v$session s where oc.HASH_VALUE = sq.HASH_VALUE and s.SID = oc.SID and s.STATUS = 'ACTIVE' and s.USERNAME='VIDS' order by sq.SQL_TEXT;
最初怀疑c3p0配置问题,发现网上曾有c3p0同样的错误,加大连接数据至500,导致sqlplus都无法连接数据库。
最后通过语句,发现很多没有提及释放连接的sql语句
SELECT osuser, a.username,cpu_time/executions/1000000||'s', b.sql_text,machine from v$session a, v$sqlarea b where a.sql_address =b.address order by cpu_time/executions desc;
总结:
V$SQL:Child cursor details for V$SQLAREA
V$SQLAREA:Shared pool details for statements/anonymous blocks
V$SQLTEXT:SQL text of statements in the shared pool
v$sql的每一行表示的是每一个sql语句的一个版本,而v$sqlarea存放的是相同语句不同版本一个group by汇总。
v$sql与v$sqlarea的源都是X$KGLCURSOR
v$sql及v$sqlarea存放着统计信息在调优时使用居多,但其sql是不全的,如果想获得完整的sql需使用v$sqltext。
通过以上信息可以得知,在使用工具排查问题时候,必须对工具区别对待。
0 0
- 数据库连接过多问题
- Sybase数据库连接数过多问题
- Spring + Hibernate 整合时数据库连接数过多问题的解决办法
- ORA-02020错误:过多的数据库连接使用中问题
- mysql数据库连接过多的错误
- 轻松解决:mysql数据库连接过多的错误
- 解决MYSQL数据库连接过多的错误
- 数据库连接过多 导致连接不上去
- MySQL数据库连接数过多的常见原因
- 解决TIME_WAIT过多问题
- 解决TIME_WAIT过多问题
- 解决TIME_WAIT过多问题
- 解决TIME_WAIT过多问题
- 解决TIME_WAIT过多问题
- 解决TIME_WAIT过多问题
- LAST_ACK过多的问题
- 解决TIME_WAIT过多问题
- UIViewController过多问题
- JAVA实验第三天
- Linux中三种SCSI target的介绍之STGT
- Objective-C基础内容简单介绍
- Deliver Form 怎样确定 Lot Serial 使用的 LOV
- opencv IplImage结构
- 数据库连接过多问题
- Python执行系统命令的方法 os.system(),os.popen(),commands
- 算法导论2.2-2——选择排序
- Incompatible .class files version in required binaries.
- git: clone、checkout、多个 ssh key 生成、 修改 commit 信息(--amend)
- LeetCode || Excel Sheet Column Title
- C#中一些字符串操作的常用用法
- Android数据库高手秘籍:SQLite命令
- Uncaught SyntaxError: Unexpected end of input 是什么意思