Oracle 客户端 ORA-12541:TNS:无侦听器

2021-12-05 00:00:00 oracle listener

我是 Oracle 数据库的新手,但我遇到了一个问题.在我的数据库服务器 (server1) 侦听器和数据库实例上运行正常,我可以使用 sqlplus 连接到这个数据库.当我使用其他服务器连接到数据库时,我检查了 TNS 配置,它是正确的,但系统说:

<块引用>

错误:ORA-12541: TNS: 没有侦听器

我的数据库是 Oracle 10gR2

那么我该如何解决这个问题?

解决方案

需要设置oracle监听所有ip地址(默认只监听localhost连接)

步骤 1 - 编辑 listener.ora

该文件位于:

  • Windows:%ORACLE_HOME% etworkadminlistener.ora.
  • Linux:$ORACLE_HOME/network/admin/listener.ora

替换 localhost with 0.0.0.0

# ...听者 =(DESCRIPTION_LIST =(描述 =(地址 = (协议 = IPC)(密钥 = EXTPROC1521))(地址 = (协议 = TCP)(主机 = 0.0.0.0)(端口 = 1521))))# ...

第 2 步 - 重启 Oracle 服务

  • Windows:WinKey + r

    services.msc

  • Linux (CentOs):

    sudo systemctl restart oracle-xe

I am new on Oracle database, but I have one issue. On my Database server (server1) listener and database instance run correctly and I can use sqlplus to connect to this DB. When I connect to database by using other server, I check the TNS configuration and it is correct but system says:

ERROR:
ORA-12541: TNS:no listener

My database is Oracle 10gR2

So how can I solve this issue?

解决方案

You need to set oracle to listen on all ip addresses (by default, it listens only to localhost connections.)

Step 1 - Edit listener.ora

This file is located in:

  • Windows: %ORACLE_HOME% etworkadminlistener.ora.
  • Linux: $ORACLE_HOME/network/admin/listener.ora

Replace localhost with 0.0.0.0

# ...

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    )
  )

# ...

Step 2 - Restart Oracle services

  • Windows: WinKey + r

    services.msc
    

  • Linux (CentOs):

    sudo systemctl restart oracle-xe
    

相关文章