大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本篇内容介绍了“如何解决sqlplus登录缓慢”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
创新互联公司于2013年创立,先为和龙等服务建站,和龙等地企业,进行企业商务咨询服务。为和龙企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
一台测试数据库,sqlplus登陆的时候,总是非常慢,按说这种sqlplus / as sysdba本地操作系统认证登录,应该很快才对,
[oracle@bisal ~]$ sqlplus / as sysdba
开始卡顿,大约等待5秒
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Dec 17 20:57:48 2020
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
登陆其他的库,都很快,几乎秒出,这就怪了,但是事出必有因,网上学习了下,通过strace看下能给我们什么信息,strace会记录进程的系统调用和这个进程接收的信号值,每次系统调用的名称、参数、返回值,都会打印到标准输出或者-o选项指定的文件,
It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments and its return value are printed on standard error or to the file specified with the -o option.
strace is a useful diagnostic, instructional, and debugging tool. System administrators, diagnosticians and trouble-shooters will find it invaluable for solving problems with programs for which the source is not readily available since they do not need to be recompiled in order to trace them. Students, hackers and the overly-curious will find that a great deal can be learned about a system and its system calls by tracing even ordinary programs. And programmers will find that since system calls and signals are events that happen at the user/kernel interface, a close examination of this boundary is very useful for bug isolation, sanity checking and attempting to capture race conditions.
man strace可以看到具体可用的参数,打印出调用时间,
执行如下指令,
[oracle@bisal ~]$ strace -T -t -o sqlplus.trc sqlplus / as sysdba
打开sqlplus.trc,一堆内容,眼花缭乱,至少对我来说,确实不太能看懂,但是我们能看懂每行记录的时间,这两步操作之间,间隔了5秒,和实际操作等待很像,
就是这条,等待了5秒,出现超时,
21:17:21 poll([{fd=9, events=POLLIN}], 1, 4991) = 0 (Timeout) <4.991529>
从上下文看,这段内容是建立了一个socket,看到有个IP,
sin_addr=inet_addr("192.168.15.2")}, 16)
这个IP是DNS服务器的,
[root@bisal ~]# vi /etc/resolv.conf# Generated by NetworkManagersearch localdomainnameserver 192.168.15.2
但是我们这台机器上没配置/etc/hosts,光是要个DNS,好像没什么用?
尝试注释resolv.conf中的IP,再次登录,这次秒出了,而且看strace的记录,socket请求的是127.0.0.1,直接访问本地了,
同理,我们如果配置DNS,
[root@bisal ~]# vi /etc/resolv.conf# Generated by NetworkManagersearch localdomainnameserver 192.168.15.2
同时配置/etc/hosts,
[root@bisal ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.15.128 bisal.com bisal
sqlplus还是很快,但是strace记录中,没出现sin_addr=inet_addr调用的IP,网络这块不太懂,如果有内行朋友,敬请指教下。
sqlplus登录慢的问题,这次我们用到了工具strace,虽然用的很浅,而且trace文件未必能看懂多少,但是根据时间戳,一些IP信息,能给我们些提示,可能这就是2-8原则,我们日常掌握的一些知识,可能不是很全面和深入,但是往往能解决日常碰到的大部分问题,这是基础,打好了基础,才可以逐渐深入,需要循序渐进,不可好高骛远。
“如何解决sqlplus登录缓慢”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!