Two slow login Problems and Solutions
Problem 1: plsql is slow to log on to the database, about 30 s
The simple process is as follows:
1. using local sqlplus "/as sysdba" to log on to the database is fast, and connecting to the database by listening for about 30 s, which means the problem lies in connecting to the database through listening.
2. capture data packets from port 1521 through tcpdump. It is found that port 1521 seldom receives database connection requests, but a packet response is generated after about 30 s, indicating that the time is spent on the processing of the listener.
3. The tracelistener process spends the following four sleep waits. The/etc/resolv. conf file is opened before each sleep to parse the address.
26676 0.000094open("/etc/resolv.conf", O_RDONLY) = 21 <0.000037>26676 0.000085 fstat(21, {st_mode=S_IFREG|0644,st_size=1267, ...}) = 0 <0.000013>26676 0.000063 mmap(NULL, 4096,PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ba737555000<0.000019>26676 0.000058 read(21, "### BEGININFO\n#\n# Modified_by: "..., 4096) = 1267 <0.000039>26676 0.000108 read(21, "",4096) = 0 <0.000016>26676 0.000046 close(21) = 0 <0.000017>26676 0.000045 munmap(0x2ba737555000, 4096) = 0<0.000024>26676 0.000080 socket(PF_FILE, SOCK_STREAM, 0)= 21 <0.000032>26676 0.000091 fcntl(21, F_GETFL) = 0x2 (flags O_RDWR) <0.000013>26676 0.000041 fcntl(21, F_SETFL,O_RDWR|O_NONBLOCK) = 0 <0.000041>26676 0.000080 connect(21, {sa_family=AF_FILE,path="/var/run/nscd/socket"}, 110) = 0 <0.000020>26676 0.000080 poll([{fd=21,events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1<0.000019>26676 0.000061 sendto(21,"\2\0\0\0\r\0\0\0\6\0\0\0hosts\0\0\0", 20, MSG_NOSIGNAL, NULL, 0) =20 <0.000016>26676 0.000048 poll([{fd=21,events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1<0.000014>26676 0.000044 recvmsg(21, {msg_name(0)=NULL,msg_iov(1)=[{"hosts\0", 6}], msg_controllen=24, {cmsg_len=20,cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {22}}, msg_flags=0}, 0) = 6<0.000018>26676 0.000069 fstat(22, {st_mode=S_IFREG|0600,st_size=217016, ...}) = 0 <0.000017>26676 0.000061 pread(22,"\1\0\0\0h\0\0\0\2664\0\0\1\0\0\0\2623\272R\0\0\0\0\323"..., 104, 0)= 104 <0.000015>26676 0.000061 mmap(NULL, 217016, PROT_READ,MAP_SHARED, 22, 0) = 0x2ba737555000 <0.000020>26676 0.000074 close(22) = 0 <0.000016>26676 0.000073 close(21) = 0 <0.000021>26676 0.000076 socket(PF_FILE, SOCK_STREAM, 0)= 21 <0.000027>26676 0.000074 fcntl(21, F_GETFL) = 0x2 (flags O_RDWR) <0.000039>26676 0.000075 fcntl(21, F_SETFL,O_RDWR|O_NONBLOCK) = 0 <0.000017>26676 0.000093 connect(21, {sa_family=AF_FILE,path="/var/run/nscd/socket"}, 110) = 0 <0.000025>26676 0.000131 poll([{fd=21,events=POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1, 5000) = 1<0.000026>26676 0.000075 writev(21,[{"\2\0\0\0\5\0\0\0\20\0\0\0", 12}, {"YZPC-ZWRZDBMAIN\0",16}], 2) = 28 <0.000024>26676 0.000059 poll( <unfinished ...>25001 4.385324 <... nanosleep resumed>{5, 0}) = 0 <5.001651>
4. comment out the nameserver, cancel DNS resolution, and solve the problem.
/Etc/resolv. conf
Problem 2: it takes about 1 minute to log on to the linux server through ssh.
1. Check the common/etc/resolv. conf file. If no problem is found, the problem is not resolved.
2. Run the "who" command to check the logon information of the current user. The logon time is not the latest.
3. Check related information on the Internet. The system may be locked due to logon issues.
4. view the locked/var/run/utmp process.
YZPC-ZWRZAPP1:/var/run # lsof | grep/var/run/utmp
Gnome-pty 447 root 5uR REG 9216 68/var/run/utmp
Gnome-pty 3979 root 5u REG 9216 68/var/run/utmp
Gnome-pty 10879 root 5u REG 9216 68/var/run/utmp
Gnome-pty 16207 root 5u REG 9216 68/var/run/utmp
Gnome-pty 16435 root 5uR REG 9216 68/var/run/utmp
Gnome-pty 28974 root 5u REG 9216 68/var/run/utmp
Gnome-pty 30390 root 5uR REG 9216 68/var/run/utmp
5. Kill the following process and solve the problem.
YZPC-ZWRZAPP1:/var/run # ps-ef | grep gnome-pty
Root 447 1 0 May20? 00:00:00 gnome-pty-helper
Root 3979 1 0 May23? 00:00:00 gnome-pty-helper
Root 4532 4050 0 00:00:00 pts/3 grep gnome-pty
Root 10879 1 0 May29? 00:00:00 gnome-pty-helper
Root 16207 1 0 May29? 00:00:00 gnome-pty-helper
Root 16435 1 0 May29? 00:00:00 gnome-pty-helper
Root 28974 1 0 :27? 00:00:00 gnome-pty-helper
Root 30390 1 0? 00:00:00 gnome-pty-helper
Summary:
1. trace and other tracing tools are used to track slow processes and find out the cause of the slow process. In the first case, trace listener is used to find that the slow process is in the step of domain name resolution.
2. Summarize the slow phenomenon and identify the cause of the problem. The suspect is that the who command is abnormal and the current user's status cannot be displayed.
3. Problem 1 is 30 s because domain name resolution has timed out for 30 s, and the second minute is not accidental.