博客
关于我
SQL*Net break/reset to client (%)等待事件
阅读量:440 次
发布时间:2019-03-06

本文共 4014 字,大约阅读时间需要 13 分钟。

 某客户通过监控发现某一套Oracle DB在一个时间段内的,异常指标!需要进行分析

 

使用如下SQL进行诊断,发现TOP EVENT 是SQL*Net break/reset to client SQL>select instance_number,event,count(*) from dba_hist_active_sess_history  where SAMPLE_TIME between to_date('2020-02-25 06','yyyy-mm-dd hh24') and   to_date('2020-02-25 09','yyyy-mm-dd hh24') and  having(count(*))>200 group by instance_number,event order by 2;

 

查询11g官方文档获取该等待事件解释说明,基本上与应用执行的程序=SQL有关系 SQL*Net break/reset to client (%)Description        The server is sending a break or reset message to the client. The session running on the server is waiting for a reply  from the client.These waits are caused by an application attempting to:Select from a closed cursorSelect on a cursor after the last row has already been fetched and no data has been returnedSelect on a non-existent tableInsert a duplicate row into a uniquely indexed tableIssuing a query with invalid syntax       If the value, v$session_wait.p2, for this parameter equals 0, it means a reset was sent to the client. A non-zero value  means that the break was sent to the client.

 

使用如下SQL 可以查询到执行SQL的用户ID=DBA_USER USER_ID=>USERNAME   以及SQL_id SQL>select event,USER_ID,sql_id,count(*) from dba_hist_active_sess_history where SAMPLE_TIME  between to_date('2020-02-25 06','yyyy-mm-dd hh24') and  to_date('2020-02-25 09','yyyy-mm-dd hh24')  and instance_number=1  and event='SQL*Net break/reset to client' group by USER_ID,event,sql_id order by 2; 数据库并未找到SQL文本,但是该库存在监控,通过监控输入SQL_ID找到SQL_TEXT 发现是查询视图! 由于本次问题,开发人员自己处理了,因此并未造成影响。开发也并未反馈是什么原因。如下进行测试模拟参考文档! https://tanelpoder.com/2008/04/10/sqlnet-breakreset-to-client/

 

如下是测试内容 SQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);SQL> begin     execute immediate 'drop table non_existent';  exception     when others then null;  end;  /SQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);null 上述可以发现,当查询一个不存在的表,但是PLSQL存在异常处理部分,并不会出现本次测试的等待事件! SQL> begin     execute immediate 'drop table non_existent';  end;  /SQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);EVENT                          TOTAL_WAITS------------------------------ -----------SQL*Net break/reset to client            2
上述可以发现,当查询一个不存在的表,但是PLSQL不存在异常处理部分,该等待事件出现! 查询一个不存在的表!
SQL> select * from non_existent;select * from non_existent              *ERROR at line 1:ORA-00942: table or view does not existSQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);EVENT                          TOTAL_WAITS------------------------------ -----------SQL*Net break/reset to client            4创建一个表,后置查询一个不存在的表!SQL> create table a as select * from employees;create table a as select * from employees                                *ERROR at line 1:ORA-00942: table or view does not existSQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);EVENT                          TOTAL_WAITS------------------------------ -----------SQL*Net break/reset to client            6查询一个视图,视图对应的表被删除SQL> create table a as select * from hr.employees;SQL> create view a_t as select EMPLOYEE_ID,FIRST_NAME from a;SQL> drop table a;SQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);EVENT                          TOTAL_WAITS------------------------------ -----------SQL*Net break/reset to client            6SQL> select * from a_t;select * from a_t              *ERROR at line 1:ORA-04063: view "SYS.A_T" has errorsSQL> select event, total_waits from v$session_event where event like '%reset%' and sid = (select sid from v$mystat where rownum = 1);EVENT                          TOTAL_WAITS------------------------------ -----------SQL*Net break/reset to client            8

 

转载地址:http://dvlyz.baihongyu.com/

你可能感兴趣的文章
MySQL分页查询
查看>>
mysql列转行函数是什么
查看>>
mysql创建函数报错_mysql在创建存储函数时报错
查看>>
mysql创建数据库和用户 并授权
查看>>
mysql创建数据库指定字符集
查看>>
MySql创建数据表
查看>>
MySQL创建新用户以及ERROR 1396 (HY000)问题解决
查看>>
MySQL创建用户与授权
查看>>
MySQL创建用户报错:ERROR 1396 (HY000): Operation CREATE USER failed for 'slave'@'%'
查看>>
MySQL创建索引时提示“Specified key was too long; max key length is 767 bytes”
查看>>
mysql初始密码错误问题
查看>>
mysql判断某一张表是否存在的sql语句以及方法
查看>>
mysql加入安装策略_一键安装mysql5.7及密码策略修改方法
查看>>
mysql加强(1)~用户权限介绍、分别使用客户端工具和命令来创建用户和分配权限
查看>>
mysql加强(3)~分组(统计)查询
查看>>
mysql加强(4)~多表查询:笛卡尔积、消除笛卡尔积操作(等值、非等值连接),内连接(隐式连接、显示连接)、外连接、自连接
查看>>
mysql加强(5)~DML 增删改操作和 DQL 查询操作
查看>>
mysql加强(6)~子查询简单介绍、子查询分类
查看>>
mysql加强(7)~事务、事务并发、解决事务并发的方法
查看>>
mysql千万级大数据SQL查询优化
查看>>