TNS-12541: TNS:no listener , TNS-12542: TNS:address already in use

來源:互聯網
上載者:User

標籤:

查看資料庫監聽狀態不對
$ lsnrctl status

LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production on 05-NOV-2012 08:54:08

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
  IBM/AIX RISC System/6000 Error: 79: Connection refused
然後手動啟動資料庫報如下錯誤:
$ lsnrctl start

LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production on 05-NOV-2012 08:54:12

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

Starting /oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production
System parameter file is /oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/product/10.2.0/db_1/network/log/listener.log
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))
TNS-12542: TNS:address already in use
 TNS-12560: TNS:protocol adapter error
  TNS-00512: Address already in use
  IBM/AIX RISC System/6000 Error: 67: Address already in use

Listener failed to start. See the error message(s) above...

/oracle/product/10.2.0/db_1/network/trace/listener.trc

明明監聽沒啟動起,卻說已經在運行了,後來終於找到原因,網上看到別人也碰到這個問題,說是HOSTS檔案設定有問題,查看本機主機名稱和hosts檔案,果然有問題,兩個IP地址指向了同一個主機名稱,將一台主機刪除後,再啟動監聽,一切OK。

用root使用者進行修改:
# cat /etc/hosts

# Internet Address      Hostname        # Comments
# 192.9.200.1          net0sample      # ethernet name/address
# 128.100.0.1          token0sample    # token ring name/address
# 10.2.0.2              x25sample      # x.25 name/address
# 2000:1:1:1:209:6bff:feee:2b7f        ipv6sample      # ipv6 name/address
127.0.0.1              loopback localhost      # loopback (lo0) name/address
192.168.101.189  test
192.168.101.190  test

再次啟動監聽:
$ lsnrctl start

LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production on 05-NOV-2012 08:58:47
Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Starting /oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production
System parameter file is /oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                    LISTENER
Version                  TNSLSNR for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production
Start Date                05-NOV-2012 08:58:49
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level              off
Security                  ON: Local OS Authentication
SNMP                      ON
Listener Parameter File  /oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File        /oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

總結:/etc/hosts檔案設定很重要,這裡設定不正確,很多地方都要出錯,特別是RAC,會報很多奇怪的錯誤,配置的時候要多注意。

 

REF:

http://www.linuxidc.com/Linux/2012-11/73694.htm

http://www.xifenfei.com/2152.html

TNS-12541: TNS:no listener , TNS-12542: TNS:address already in use

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.