Oracle

TNS-12541 錯誤

  • April 1, 2015

我在我的電腦上安裝了網格,但問題是 LISTENER 沒有自動啟動。我必須手動啟動偵聽器,然後只有 LISTENER 開始。但是,如果您先檢查狀態,則在啟動偵聽器之前,如果您嘗試 LSNRCTL STATUS,則會顯示以下內容。我遵循以下網址,但它對我不起作用: Linux 錯誤:111:連接被拒絕 LSNRCTL

我的問題是我應該如何讓監聽器自動執行?

請檢查以下必要的必填資訊:-

[grid@netsystemsolution ~]$ lsnrctl status    
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2015 12:01:56
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netsystemsolution[dot]com)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

如果您從中檢查偵聽器的狀態,crvctl則顯示如下:

[grid@netsystemsolution ~]$ srvctl status listener 
PRCN-2044 : No listener exists
[grid@netsystemsolution ~]$ srvctl config listener
PRCN-2044 : No listener exists
[grid@netsystemsolution ~]$

主機資訊:

[root@netsystemsolution ~]# vi /etc/hosts
192.168.0.1 netsystemsolution[dot]com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@netsystemsolution ~]# hostname
netsystemsolution [dot]com
[root@netsystemsolution ~]# ping netsystemsolution[dot]com
PING netsystemsolution[dot]com (192.168.0.1) 56(84) bytes of data.
64 bytes from netsystemsolution[dot]com (192.168.0.1): icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from netsystemsolution[dot]com (192.168.0.1): icmp_seq=2 ttl=64 time=0.034 ms
64 bytes from netsystemsolution[dot]com (192.168.0.1): icmp_seq=3 ttl=64 time=0.042 ms
--- netsystemsolution[dot]com ping statistics --- 
6 packets transmitted, 6 received, 0% packet loss, time 5525ms
rtt min/avg/max/mdev = 0.033/0.035/0.042/0.008 ms
[root@netsystemsolution ~]#

我按照以下 url 進行 listener.ora、sqlnet.ora 和 tnsnames.ora 配置 http://oracle-base.com/articles/misc/oracle-network-configuration.php

LISTENER.ORA 資訊:

[grid@netsystemsolution ~]$ cd $ORACLE_HOME/network/admin
[grid@netsystemsolution admin]$
[grid@netsystemsolution admin]$ vi listener.ora

# Generated by Oracle configuration tools.
#LISTENER =
#  (DESCRIPTION =
#    (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
#  )
#ADR_BASE_LISTENER = /u01/app/grid
#ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
     )
   )
 )
SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
     (GLOBAL_DBNAME = ORCL.netsystemsolution[dot]com)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
     (SID_NAME = ORCL)
   )
 )

SQLNET.ORAI 資訊:

[grid@netsystemsolution admin]$ vi sqlnet.ora
# sqlnet.ora Network Configuration File: /u01/app/11.2.0/grid/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (ALL)
#NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME)
#ADR_BASE = /u01/app/grid
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT_DOMAIN = netsystemsolution[dot]com

TNSNAMES.ORA 資訊:

[grid@netsystemsolution admin]$ vi sqlnet.ora
# tnsnames.ora Network Configuration File: /u01/app/11.2.0/grid/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
#ORCL =
#  (DESCRIPTION =
#    (ADDRESS_LIST =
#      (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
#    )
#    (CONNECT_DATA =
#      (SERVICE_NAME = orcl)
#    )
#  )

ORCL.netsystemsolution[dot]com =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = ORCL.netsystemsolution[dot]com)
   )
 )


[grid@netsystemsolution ~]$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
              ONLINE  ONLINE       netsystemsolution                            
ora.FRA1.dg
              ONLINE  ONLINE       netsystemsolution                            
ora.asm
              ONLINE  ONLINE       netsystemsolution        Started             
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
     1        ONLINE  ONLINE       netsystemsolution                            
ora.diskmon
     1        OFFLINE OFFLINE                                                   
ora.evmd
     1        ONLINE  ONLINE       netsystemsolution                            
ora.orcl.db
     1        ONLINE  ONLINE       netsystemsolution        Open                
ora.tstdbdup.db
     1        ONLINE  OFFLINE                                                   
[grid@netsystemsolution ~]$ 

現在我使用lsnrcrl命令手動啟動了監聽器,它顯示了以下內容:

[grid@netsystemsolution admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2015 12:18:59
copyright (c) 1991, 2011, Oracle.  All rights reserved.
Starting /u01/app/11.2.0/grid/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/11.2.0/grid/network/admin/listener.ora
Log messages written to /u01/app/grid/diag/tnslsnr/netsystemsolution/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=netsystemsolution[dot]com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netsystemsolution[dot]com)(PORT=1521)))

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                01-JAN-2015 12:18:59
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication 
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/netsystemsolution/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=netsystemsolution[dot]com)(PORT=1521)))
Services Summary...
Service "ORCL.netsystemsolution[dot]com" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[grid@netsystemsolution admin]$

現在,如果您等待 10 到 15 秒,在此之後,這就是它所顯示的內容:

[grid@netsystemsolution admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2015 12:20:45
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netsystemsolution[dot]com)(PORT=1521)))

STATUS of the LISTENER
------------------------

Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                01-JAN-2015 12:18:59
Uptime                    0 days 0 hr. 1 min. 45 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/netsystemsolution/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=netsystemsolution[dot]com)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
 Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "ORCL.netsystemsolution[dot]com" has 1 instance(s).
 Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
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...
The command completed successfully
[grid@netsystemsolution admin]$

啟動監聽器後,lsnrctl start...如果您需要再次查看 1521 是否正在執行,那麼這裡是:

[grid@netsystemsolution admin]$ netstat -nltp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name 
tcp        0      0 0.0.0.0:20335               0.0.0.0:*                   LISTEN      -                 
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -                 
tcp        0      0 127.0.0.1:5939              0.0.0.0:*                   LISTEN      -                 
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      -                 
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      -                 
tcp        0      0 192.168.0.1:25              0.0.0.0:*                   LISTEN      -                 
tcp        0      0 :::111                      :::*                        LISTEN      -                 
tcp        0      0 :::1521                     :::*                        LISTEN                              7268/tnslsnr      
tcp        0      0 :::45877                    :::*                        LISTEN      -                 
tcp        0      0 :::22                       :::*                        LISTEN      -                 
tcp        0      0 ::1:631                     :::*                        LISTEN      -                 
tcp        0      0 ::1:25                      :::*                        LISTEN      -                 
tcp        0      0 :::28835                    :::*                        LISTEN      -      
[grid@netsystemsolution admin]$

我想知道問題出在哪裡?為什麼我必須手動啟動監聽器?為什麼監聽器不自動啟動?請建議。

在 Oracle Grid Infrastructure 中註冊偵聽器的最簡單方法是執行netca. 如果你想配置監聽器“LISTENER”,你必須確保它在 listener.ora 中不存在。

/etc/hosts還有一件事:您應該始終在文件中配置自己的主機。

crsctl status resource -t清楚地顯示了問題的原因,偵聽器未在集群件中註冊。撤消 listener.ora 中的所有更改(或簡單地刪除它),然後:

srvctl add listener
srvctl start listener

引用自:https://dba.stackexchange.com/questions/87397