[Oracle] sqlplus连接数据库缓慢问题


本文总阅读量

1、使用strace跟踪用户空间进程

strace -t -T -o /tmp/sqlplus.log sqlplus / as sysdba
将日志打印到/tmp/sqlplus.log目录下,查看日志文件,发现去请求202.106.0.20这个ip耗时较长

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
15:26:40 munmap(0x7fbb152d3000, 28871)  = 0 <0.000024>
15:26:40 socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 9 <0.000021>
15:26:40 connect(9, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("202.106.0.20")}, 16) = 0 <0.000043>
15:26:40 poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ([{fd=9, revents=POLLOUT}]) <0.000017>
15:26:40 sendmmsg(9, {{{msg_name(0)=NULL, msg_iov(1)=[{"|\266\1\0\0\1\0\0\0\0\0\0\7centos7\0015\0\0\1\0\1", 27}], msg_controllen=0, msg_flags=MSG_EOR|MSG_WAITALL|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_NOSIGNAL|MSG_WAITFORONE|MSG_FASTOPEN|0x9a8a0000}, 27}, {{msg_name(0)=NULL, msg_iov(1)=[{"\320\1\1\0\0\1\0\0\0\0\0\0\7centos7\0015\0\0\34\0\1", 27}], msg_controllen=0, msg_flags=MSG_CONFIRM}, 27}}, 2, MSG_NOSIGNAL) = 2 <0.000088>
15:26:40 poll([{fd=9, events=POLLIN}], 1, 5000) = 0 (Timeout) <5.005164>
15:26:45 poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ([{fd=9, revents=POLLOUT}]) <0.000023>
15:26:45 sendmmsg(9, {{{msg_name(0)=NULL, msg_iov(1)=[{"|\266\1\0\0\1\0\0\0\0\0\0\7centos7\0015\0\0\1\0\1", 27}], msg_controllen=0, msg_flags=MSG_EOR|MSG_WAITALL|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_NOSIGNAL|MSG_WAITFORONE|MSG_FASTOPEN|0x9a8a0000}, 27}, {{msg_name(0)=NULL, msg_iov(1)=[{"\320\1\1\0\0\1\0\0\0\0\0\0\7centos7\0015\0\0\34\0\1", 27}], msg_controllen=0, msg_flags=MSG_CONFIRM}, 27}}, 2, MSG_NOSIGNAL) = 2 <0.000149>
15:26:45 poll([{fd=9, events=POLLIN}], 1, 5000) = 1 ([{fd=9, revents=POLLIN}]) <0.219407>
15:26:45 ioctl(9, FIONREAD, [102]) = 0 <0.000026>
15:26:45 recvfrom(9, "|\266\201\203\0\1\0\0\0\1\0\0\7centos7\0015\0\0\1\0\1\0\0\6\0\1"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("202.106.0.20")}, [16]) = 102 <0.000041>
15:26:45 poll([{fd=9, events=POLLIN}], 1, 4779) = 0 (Timeout) <4.783905>
15:26:50 poll([{fd=9, events=POLLOUT}], 1, 0) = 1 ([{fd=9, revents=POLLOUT}]) <0.000022>
15:26:50 sendto(9, "|\266\1\0\0\1\0\0\0\0\0\0\7centos7\0015\0\0\1\0\1", 27, MSG_NOSIGNAL, NULL, 0) = 27 <0.000118>
15:26:50 poll([{fd=9, events=POLLIN}], 1, 5000) = 0 (Timeout) <5.005199>

2、查看这个ip是用于dns解析的ip,发现当前网络去请求这个ip有问题,连接较慢,因此将该dns配置ip修改为其他,如(114.114.114.114),修改完成重启网络,再次使用命令sqlplus / as sysdba,访问恢复正常。

目录
  1. 1. 1、使用strace跟踪用户空间进程
  2. 2. 2、查看这个ip是用于dns解析的ip,发现当前网络去请求这个ip有问题,连接较慢,因此将该dns配置ip修改为其他,如(114.114.114.114),修改完成重启网络,再次使用命令sqlplus / as sysdba,访问恢复正常。

Proudly powered by Hexo and Theme by Lap
本站访客数人次
© 2020 zeven0707's blog