----如下语句在某会话执行120次
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
update t_network set a=a+1;
--查看某会话的事件
EVENT TOTAL_WAITS TIME_WAITED AVERAGE_WAIT
---------------------------------------------------------------- ----------- ----------- ------------
SQL*Net message to client 143 0 0
SQL*Net message from client 142 4748 33.44 --sql*net message from client猛增和to client
Disk file operations I/O 3 0 0.08
log file sync 1 0 0.07
--如果把上述的120次执行的sql用plsql实现又是如何呢
SQL> begin
2 for i in 1..125 loop
3 update t_network set a=a+1;
4 commit;
5 end loop;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> /
EVENT TOTAL_WAITS TIME_WAITED AVERAGE_WAIT
---------------------------------------------------------------- ----------- ----------- ------------
SQL*Net message to client 15 0 0
SQL*Net message from client 14 1727 123.38 --总的等待次数及总的等待时间大为下降
Disk file operations I/O 2 0 0.07
log file sync 1 0 0.11
SQL>
小结:如果上述的sql*net message from/to client大量上升,表示sql执行次数很高,从这块入手处理下问题
这就是为何要用plsql封装重复执行的sql原因,不然oracle与客户端多次交互,会影响客户的响应感觉与响应时间
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-761562/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-761562/