‘lsnrctl status’ could not display the status of running listener correctly

  • 1,101 views
  • Read

My friend got this issue and wanted to know the reason, so I built a test VM to verify it.

The dbss scirpt was used to start their instances and he found if he run 'dbss start' then he could get the correct information about listener:

oracle@linux-ryjt:~> lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 10-JUN-2018 22:47:47

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-ryjt)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                10-JUN-2018 22:08:46
Uptime                    0 days 0 hr. 39 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/linux-ryjt/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-ryjt)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=linux-ryjt)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdborcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

While if he run 'systemctl start dbss' then would get below error:

oracle@linux-ryjt:~> lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 10-JUN-2018 20:26:07

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux-ryjt)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory

And below was the config file of systemd service:

cat /usr/lib/systemd/system/dbss.service
[Unit]
Description=Oracle
After=network.target

[Service]
Type=oneshot
#PIDFile=/users/oracle/dbss.pid
ExecStart=/usr/bin/dbss.sh start
ExecReload=
ExecStop=/usr/bin/dbss.sh stop
PrivateTmp=true
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

At the beginning I did not use his config file as the dbss script would generate one automatically, and I could not reproduce this issue, so I knew this issue was caused by his config file.

At the same time, I found below information from the strace file:

11323 read(7, "\0>\0\0\5\0\0\0\0004(DESCRIPTION=(ADDRESS="..., 8208) = 62
11323 setsockopt(7, SOL_SOCKET, SO_SNDTIMEO, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
11323 setsockopt(7, SOL_SOCKET, SO_RCVTIMEO, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
11323 close(7)                          = 0
11323 access("/var/tmp/.oracle", F_OK)  = 0
11323 chmod("/var/tmp/.oracle", 01777)  = -1 EPERM (Operation not permitted)
11323 socket(PF_LOCAL, SOCK_STREAM, 0)  = 7
11323 access("/var/tmp/.oracle/s#10374.2", F_OK) = -1 ENOENT (No such file or directory)
11323 access("/var/tmp/o/s#10374.2", F_OK) = -1 ENOENT (No such file or directory)
11323 close(7)                          = 0
11323 lseek(6, 40448, SEEK_SET)         = 40448
11323 read(6, "\16\0\3610\0\0\\\0\3630\0\0\231\0\3640\0\0\263\0\3650\0\0\307\0\3660\0\0\345\0"..., 512) = 512
11323 lseek(6, 41472, SEEK_SET)         = 41472
11323 read(6, "\21\0\0201\0\0n\0\0211\0\0\210\0\0221\0\0\231\0\0241\0\0\256\0\0261\0\0\304\0"..., 512) = 512
11323 lseek(6, 14336, SEEK_SET)         = 14336
11323 read(6, "\17\0;\1\0\0b\0<\1\0\0\250\0=\1\0\0\314\0\365\1\0\0\360\0\366\1\0\0\6\1"..., 512) = 512
11323 write(1, "TNS-12541: TNS:no listener\n TNS-"..., 136) = 136
11323 lseek(6, 18944, SEEK_SET)         = 18944
11323 read(6, "\17\0\23\4\0\0b\0\24\4\0\0z\0\25\4\0\0\243\0\26\4\0\0\320\0\27\4\0\0\363\0"..., 512) = 512
11323 write(1, "Connecting to (DESCRIPTION=(ADDR"..., 70) = 70
11323 socket(PF_LOCAL, SOCK_STREAM, 0)  = 7
11323 access("/var/tmp/.oracle/sEXTPROC1521", F_OK) = -1 ENOENT (No such file or directory)
11323 access("/var/tmp/o/sEXTPROC1521", F_OK) = -1 ENOENT (No such file or directory)
11323 close(7)                          = 0
11323 lseek(6, 40448, SEEK_SET)         = 40448
11323 read(6, "\16\0\3610\0\0\\\0\3630\0\0\231\0\3640\0\0\263\0\3650\0\0\307\0\3660\0\0\345\0"..., 512) = 512
11323 lseek(6, 41472, SEEK_SET)         = 41472
11323 read(6, "\21\0\0201\0\0n\0\0211\0\0\210\0\0221\0\0\231\0\0241\0\0\256\0\0261\0\0\304\0"..., 512) = 512
11323 lseek(6, 14336, SEEK_SET)         = 14336
11323 read(6, "\17\0;\1\0\0b\0<\1\0\0\250\0=\1\0\0\314\0\365\1\0\0\360\0\366\1\0\0\6\1"..., 512) = 512
11323 write(1, "TNS-12541: TNS:no listener\n TNS-"..., 136) = 136

And also I found I could access the database using ezconnect.

I remembered listener should create some socket files under /tmp/.oracle or /var/tmp/.oracle, but from the strace file we could not find such files and got the 'TNS-12541: TNS:no listener' error.

I rechecked his config file and found there was one option 'PrivateTmp=true' and I seldom used it, so Google helped me:

PrivateTmp=
    Takes a boolean argument. If true sets up a new file system
    namespace for the executed processes and mounts a private /tmp
    directory inside it, that is not shared by processes outside of
    the namespace. This is useful to secure access to temporary files
    of the process, but makes sharing between processes via /tmp
    impossible. Defaults to false.

So I removed it and tested all the things again, now the listener worked well. ‘lsnrctl status’ could not display the status of running listener correctly

  • by Published on 11/06/2018 04:55:36
  • Repost please keep this link: https://www.dbcloudsvc.com/blogs/linux/lsnrctl-status-could-not-display-the-status-of-running-listener-correctly/
Comments  1  Guest  1
    • Rainny
      Rainny 0

      Very appreciate for this test and I will deploy it as soon as possible, thank you my good friend!

    匿名

    Comment

    Anonymous Write

    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

    Decide