设为首页 收藏本站
查看: 1429|回复: 0

[经验分享] ORACLE等待事件:SQL*Net message from client & SQL*Net message to client

[复制链接]

尚未签到

发表于 2017-12-11 06:12:35 | 显示全部楼层 |阅读模式
在ORACLE当中有两个很常见的等待事件“SQL*Net message from client”与“SQL*Net message to client”,两者有点区别,下面整理这方面的资料如下:



SQL*Net message from client      表示服务端等待着Cilent发来请求让它处理,这时就会产生SQL*Net message from client等待事件。

                                而我们把这种Wait叫做空闲事件(ildel event),并不代表真正的Loading.


SQL*Net message to client       这个等待事件发生在服务段向客户端发送消息或数据的时候,一般意味着网络瓶颈或不正确的TCP连接配置。

                                当然它不能做为对网络延迟的准确评估或量化




SQL*Net message from client




"Generally SQL*Net message from client means Oracle is just waiting on some work to do.  The SQL*Net message from client means that you have a session connected and Oracle is waiting for a command so it can do something.

If you're thinking that SQL*Net message from client is the cause of a performance issue, there's likely another underlying issue such as the application connecting but not running any statements (which is not an Oracle issue but would appear to the end user as a performance problem), or you're looking in the wrong place for the source of the performance problem."



关于SQL*Net message from client 这种等待事件,很好模拟,如下所示,会话68执行了一个SQL后,一直没有向服务器端发送任何SQL语句,那么在服务器端,会话68一直处于SQL*Net message from client等待事件



会话68连接到数据库后,执行完一个SQL后,不再做任何操作。如下所示:


SQL> show user;USER 为 "TEST"SQL> select * from v$mystat where rownum=1;        SID STATISTIC#      VALUE---------- ---------- ----------        68          0          0


会话72中查看会话68的状态,就会发现会话68处于SQL*Net message from client等待


SQL> show user;USER is "SYS"SQL> select * from v$mystat where rownum=1;        SID STATISTIC#      VALUE---------- ---------- ----------        72          0          0 SQL> select sid, seq#, event, wait_class,seconds_in_wait   2  from v$session_wait where sid=68;        SID       SEQ# EVENT                            WAIT_CLASS SECONDS_IN_WAIT---------- ---------- -------------------------------- ---------- ---------------        68         42 SQL*Net message from client     >


但是如果此时在会话68里面执行一个SQL语句,你会看到SECONDS_IN_WAIT就会清零重新开始计时。



DSC0000.png



DSC0001.png




另外还有一种特殊情况,例如当客户端遭遇网络异常或应用程序奔溃、操作系统蓝屏等等,那么此时对应的会话也会可能遇到SQL*Net message from client空闲等待事件,当然绝大部分情况下,这个等待事件是可以忽略的。




SQL*Net message to client


The SQL*Net message to client  may indicate a network-related issue that causes clients too long to get data from the database server.  Thus, it can be a TCP issue, but it is not limited to that.


Common causes of a high SQL*Net message to client might include TCP/IP bottlenecks or TNS parameter issues:

High network latency:  Check with netstat to ensure that your TCP/IP does not have bottlenecks.

Incorrect TNS parameters:  Setting such as tcp.nodelay can impact the time for SQL message to client waits.  See these tips on Oracle TNS network tuning .

The SQL*Net message to client Oracle metric indicates the server (foreground process) is sending a message to the client.  Network bottlenecks are very common in distributed systems and those with high network traffic


“So, if you’re sending loads of data over a slow link or mis-configured TCP connection, the “SQL*Net message to client” wait time can be used as a low-confidence indicator of your SQL*Net throughput (in conjunction with “bytes sent via SQL*Net to client”), but never a measure of network latency!”



SQL * Net message to client等待事件发生在当一个服务器进程已经发送数据或消息到客户端并正等待回复的时候.这个等待时间是等待从TCP(Transparent Network Substrate)等待响应的时间.这个等待事件通常被认为是一个Network等待事件。SQL * Net message to client等待事件一般意味着网络瓶颈或不正确的TCP连接配置。但是它不能做为对网络延迟的准确评估或量化。当服务端在发送大量数据时, 您可以看到 "SQL * Net message to client" 等待事件所花的时间更长。这个发生在TCP发送缓冲区(TCP send buffer )已满时, 因此TCP堆栈无法接受更多的数据包。数据传送将被阻塞, 直到远程站点发送返回的 ACK 数据包表示它在 TCP 传输流( TCP transmission stream)中的哪些数据已经接收到了。


对于SQL * Net more data to client等待事件,ORACLE使用SDU(session data unit)会话数据单元将SDU缓存写入到TCP套接字缓存中.如果数据比会话数据单元的初始大小大那么数据需要被多次的发送.如果有大量的数据被发送然后在每批数据发送后这个会话将会等待'SQL * Net more data to client'等待事件.


ORACLE NET允许通过参数SDU(会话数据单元)和TDU(传输数据单元)来控制数据包的大小.它们分别控制会话层和传输层的缓存大小.TDU在数在ORACLE NET v8.0中已经被废弃.






参考资料:


http://www.dba-oracle.com/m_sql_net_message_to_client.htm

http://blog.tanelpoder.com/2008/02/07/sqlnet-message-to-client-wait-gotcha/

http://www.dba-oracle.com/t_sql_net_message_network_throughput.htm

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-422835-1-1.html 上篇帖子: Oracle SqlPlus导出查询结果 下篇帖子: Linux平台 Oracle 12cR2 RAC安装Part2:GI配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表