数据库
首页 > 数据库> > oracle – TNS-12541错误

oracle – TNS-12541错误

作者:互联网

我在我的电脑上安装了网格,但问题是LISTENER无法自动启动.我必须手动启动监听器,然后只启动LISTENER.但是在启动监听器之前如果先检查状态,那么如果您尝试LSNRCTL状态,则会显示以下内容.我遵循了以下网址,但它对我不起作用:
Linux Error: 111: Connection refused 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再次启动…如果你需要查看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文件中配置自己的主机.

标签:linux,oracle,configuration,oracle-11g-r2,oracle-sql-developer
来源: https://codeday.me/bug/20190806/1597892.html