您好,登錄后才能下訂單哦!
本篇內容介紹了“如何解決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 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)
[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登錄緩慢”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。