手机版
你好,游客 登录 注册
背景:
阅读新闻

ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务的解决

[日期:2019-07-16] 来源:Linux社区  作者:Linux [字体: ]

解决问题:ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务

测试环境:RedHat7.4 + Oracle 11g 64位

相关说明:

数据库服务器:

Oracle11g 64位软件的安装位置为/u01/app/oracle/product/11.2.0/dbhome_1,数据库名为默认的orcl,

RedHat7.4虚拟机的IP设置为:192.168.8.13

Windows10客户端:

1、PLSQL安装位置:E:\Program Files\PLSQL Developer

2、Oracle客户端位置:E:\app

打开E:\app\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora文件

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 虚拟机IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
))

3.添加一个环境变量,名为TNS_ADMIN,值为tnsnames.ora文件所在路径E:\app\product\11.2.0\dbhome_1\NETWORK\ADMIN,plsql通过这个找到orcl连接字符串

4.添加一个环境变量NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK

遇到问题:

使用plsql连接数据库服务器:“ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务”

解决办法简述:

1.修改E:\app\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora中的localhost改为192.168.8.13;

2.修改E:\app\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora中的localhost 改为 192.168.8.13;

3.修改后,重启oracle,监听,并注册,主win10上的plsql就可以远程连接虚拟机上的数据库了。

具体操作步骤如下:

一、修改数据库服务器中listener.ora文件内容

命令:

# vi /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

原始内容:

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = /u01/app/oracle

修改后的内容如下:

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
    (SID_LIST =
        (SID_DESC =
            (GLOBAL_DBNAME = orcl)
            (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
            (SID_NAME = orcl)
        )
    )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    )
  )


ADR_BASE_LISTENER = /u01/app/oracle

或者LISTENER这里改的简单一些,改用IP地址也行

LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.13)(PORT = 1521)))

二、修改数据库服务器中tnsnames.ora文件内容

命令:

# vi /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

原始内容:

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

修改后的内容:

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
orcl =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.13)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = orcl)
    )
  )

三、在数据库服务器中启动监听并更新注册

最后重启一下监听与数据库并更新注册
$ lsnrctl stop        #先关闭监听服务
$ lsnrctl start        #开启监听服务
$ sqlplus / as sysdba      #登入
SQL> shutdown immediate    #立即关闭数据库服务
SQL> startup        #开启数据库服务
命令:SQL> alter system register;  #注册
System altered.
SQL>
SQL> quit #登出
输出:
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

四、Windows10客户端下的测试步骤:使用plsqldev.exe测试,

修改E:\app\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora文件,新增到虚拟机Oracle的连接内容:

# tnsnames.ora Network Configuration File:E:\app\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.13)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
NH =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.19)(PORT = 1525))
    )
    (CONNECT_DATA =
      (SID = nh)
    )
  )

更多Oracle相关信息见Oracle 专题页面 https://www.linuxidc.com/topicnews.aspx?tid=12

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2019-07/159379.htm

linux
相关资讯       ORA-12514 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款