Ucloud云上Oracle数据库服务器,由于物理机宕机重启,造成虚机也重启了,手动启动oracle服务和listen监听以后,PL/SQL客户端和应用都无法连接,提示“ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务”,数据库版本Oracle 11g R2,
初步判断是listener.ora 文件有问题,

# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.28.109.115)(PORT = 1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /data/app/oracle/product/11.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = earth_m1)
      (ORACLE_HOME = /data/app/oracle/product/11.2.0/db_1)
    )
  )

ADR_BASE_LISTENER = /data/app/oracle

备份原来监听文件:

cp /data/app/oracle/product/11.2.0/db_1/network/admin/listener.ora /tmp/listener.ora

修改为如下:

vim /data/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.28.109.115)(PORT = 1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = powerdes)
      (ORACLE_HOME = /data/app/oracle/product/11.2.0/db_1)
      (SID_NAME = powerdes)
    )
    (SID_DESC =
      (SID_NAME = earth_m1)
      (ORACLE_HOME = /data/app/oracle/product/11.2.0/db_1)
    )
  )

ADR_BASE_LISTENER = /data/app/oracle

Listener主动加载服务

  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = powerdes)
      (ORACLE_HOME = /data/app/oracle/product/11.2.0/db_1)
      (SID_NAME = powerdes)
    )

添加GLOBAL_DBNAME后在使用lsnrctl start监听程序时会将listener的服务注册到进程监视器(pmon)中,如果没有这个配置,则为Listener被动加载服务由实例的pmon进程在listener中注册服务,对listener来讲,就是被动了,也就是为什么先启动监听后启动数据库能够正常连接的,反之不行的原因了。

Tags标签: oracle,监听,tns Tags相关文章如下:

上一篇:Kvm虚拟机静态迁移

下一篇:Redis高可用方案之sentinel(哨兵集群)