温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何解决sqlplus登录缓慢

发布时间:2021-10-21 13:47:38 来源:亿速云 阅读:497 作者:iii 栏目:编程语言

本篇内容介绍了“如何解决sqlplus登录缓慢”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

一台测试数据库,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 2020Version 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 - ProductionVersion 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可以看到具体可用的参数,打印出调用时间,

如何解决sqlplus登录缓慢

执行如下指令,

[oracle@bisal ~]$ strace -T -t -o sqlplus.trc sqlplus / as sysdba

打开sqlplus.trc,一堆内容,眼花缭乱,至少对我来说,确实不太能看懂,但是我们能看懂每行记录的时间,这两步操作之间,间隔了5秒,和实际操作等待很像,

如何解决sqlplus登录缓慢

就是这条,等待了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,直接访问本地了,

如何解决sqlplus登录缓慢

同理,我们如果配置DNS,

[root@bisal ~]# vi /etc/resolv.conf# Generated by NetworkManagersearch localdomainnameserver 192.168.15.2

同时配置/etc/hosts,

[root@bisal ~]# vi /etc/hosts127.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登录缓慢”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI