19c sqlplus / as sysdba 登录慢分析

联系:手机/微信(+86 17813235971) QQ(107644445)QQ咨询惜分飞

标题:19c sqlplus / as sysdba 登录慢分析

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

sqlplus / as sysdba登录非常慢

[oracle@xifenfei trace]$ date
Fri Oct 29 00:04:27 CST 2021
[oracle@xifenfei trace]$ sqlplus / as sysdba<< EOF
> exit;
> EOF

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Oct 29 00:04:28 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.



Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@xifenfei trace]$ date
Fri Oct 29 00:04:49 CST 2021

sqlpus 一个简单的登录+退出使用了22秒,严重的慢,通过strace分析发现访问以下两个ip,但是10.11.0.41非常慢,10.13.0.41很快,并且通过一些信息53端口,判断可能是dns服务器的ip

connect(9, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.13.0.41")}, 16) = 0

connect(12, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.11.0.41")}, 16) = 0

进一步确认,确认是该服务器配置的dns服务器

[root@xifenfei ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.13.0.41
nameserver 10.11.0.41

对这两个ip的连通性进行测试

[root@xifenfei ~]# ping 10.13.0.41
PING 10.13.0.41 (10.13.0.41) 56(84) bytes of data.
64 bytes from 10.13.0.41: icmp_seq=1 ttl=126 time=0.616 ms
^C
--- 10.13.0.41 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.616/0.616/0.616/0.000 ms
[root@xifenfei ~]# ping  10.11.0.41
PING 10.11.0.41 (10.11.0.41) 56(84) bytes of data.
^C
--- 10.11.0.41 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2063ms

[root@xifenfei ~]# 

确认10.11.0.41 ip不通,对于此类问题最快的解决方案就是除掉不可使用的dns服务器,然后测试登录和退出时间

[oracle@szd18dbts01 trace]$ date
Fri Oct 29 00:21:12 CST 2021
[oracle@szd18dbts01 trace]$ sqlplus / as sysdba<< EOF
> exit;
> EOF

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Oct 29 00:21:12 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

date

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@szd18dbts01 trace]$ date
Fri Oct 29 00:21:13 CST 2021

通过除掉不可用的dns服务器ip之后,测试时间为1s,恢复正常