如何解決sqlplus登錄緩慢

本篇內容介紹了“如何解決sqlplus登錄緩慢”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,先為和龍等服務建站,和龍等地企業(yè),進行企業(yè)商務咨詢服務。為和龍企業(yè)網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。

一臺測試數(shù)據(jù)庫,sqlplus登陸的時候,總是非常慢,按說這種sqlplus / as sysdba本地操作系統(tǒng)認證登錄,應該很快才對,

[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會記錄進程的系統(tǒng)調用和這個進程接收的信號值,每次系統(tǒng)調用的名稱、參數(shù)、返回值,都會打印到標準輸出或者-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可以看到具體可用的參數(shù),打印出調用時間,

如何解決sqlplus登錄緩慢

執(zhí)行如下指令,

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

打開sqlplus.trc,一堆內容,眼花繚亂,至少對我來說,確實不太能看懂,但是我們能看懂每行記錄的時間,這兩步操作之間,間隔了5秒,和實際操作等待很像,

如何解決sqlplus登錄緩慢

就是這條,等待了5秒,出現(xiàn)超時,

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記錄中,沒出現(xiàn)sin_addr=inet_addr調用的IP,網絡這塊不太懂,如果有內行朋友,敬請指教下。

sqlplus登錄慢的問題,這次我們用到了工具strace,雖然用的很淺,而且trace文件未必能看懂多少,但是根據(jù)時間戳,一些IP信息,能給我們些提示,可能這就是2-8原則,我們日常掌握的一些知識,可能不是很全面和深入,但是往往能解決日常碰到的大部分問題,這是基礎,打好了基礎,才可以逐漸深入,需要循序漸進,不可好高騖遠。

“如何解決sqlplus登錄緩慢”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識可以關注創(chuàng)新互聯(lián)網站,小編將為大家輸出更多高質量的實用文章!

本文題目:如何解決sqlplus登錄緩慢
文章網址:http://bm7419.com/article20/jdedco.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)外貿網站建設、靜態(tài)網站、網站策劃域名注冊、網站建設

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

網站托管運營