記錄一次一次監聽無法連線的錯誤

yingyifeng306發表於2023-10-07

$ lsnrctl status

LSNRCTL for IBM/AIX RISC System/6000: Version 9.2.0.1.0 – Production on 21-JAN-2011 10:59:25

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aixsvr)(PORT=1521)))
    TNS-12618: TNS:versions are incompatible

上述報錯是因為埠號1521已經被另一個監聽使用。於是修改該監聽的listener.ora檔案,將埠改為1555.
    vi listener.ora
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS_LIST =
            (ADDRESS = (PROTOCOL = TCP)(HOST = aixsvr)(PORT = 1555))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
          )
        )
      )

SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = orcl)
          (ORACLE_HOME = /ora9i/app/oracle)
      ))
    $ lsnrctl reload

LSNRCTL for IBM/AIX RISC System/6000: Version 9.2.0.1.0 – Production on 21-JAN-2011 10:55:39

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aixsvr)(PORT=1555)))
    TNS-12541: TNS:no listener
     TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       IBM/AIX RISC System/6000 Error: 79: Connection refused
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
    TNS-12541: TNS:no listener
     TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       IBM/AIX RISC System/6000 Error: 79: Connection refused

一開始的思路如下:
    IBM/AIX RISC System/6000 Error: 79: Connection refused錯誤是不是表示1555埠未開放?用telnet測試:
    telnet aixsvr 1555
    $ telnet aixsvr 1555
    Trying…
    telnet: connect: A remote host refused an attempted connect operation.
    $ telnet aixsvr 1521
    Trying…
    Connected to aixsvr.
    Escape character is '^]'.
    看到以上結果就想到是1555埠的問題,實際上這個思路是錯誤的,因為單純的說埠開不開放是沒有意義的,埠必須與程式或服務結合起來才有意義。即要先啟動1555上的監聽才能使用telnet aixsvr 1555的方式測試該埠是否可以連線。沒有服務或程式支援的埠是無法連線的
    解決辦法:
    修改了listener.ora的埠,使用reload,可能因為記憶體中有相關資訊,導致了reload失敗,修改一下監聽的名字,再修改回來,然後重啟監聽,使用lsnrctl stop和lsnrctrl start就可以了。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23732248/viewspace-2987186/,如需轉載,請註明出處,否則將追究法律責任。

相關文章