ORA12514 TNS 监听程序当前无法识别连接描述符中请

2023年 4月 29日 38.5k 0

解决问题:ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务 测试环境:RedHat7.4 + Oracle 11g 64位 相关说明: 数据库服务器: Oracle11g 64位软件的安装位置为/u01/app/oracle/product/11.2.

解决问题: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 FilesPLSQL Developer

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

打开E:appproduct11.2.0dbhome_1NETWORKADMINtnsnames.ora文件

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

3.添加一个环境变量,名为TNS_ADMIN,值为tnsnames.ora文件所在路径E:appproduct11.2.0dbhome_1NETWORKADMIN,plsql通过这个找到orcl连接字符串

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

遇到问题:

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

解决办法简述:

1.修改E:appproduct11.2.0dbhome_1NETWORKADMINlistener.ora中的localhost改为192.168.8.13;

2.修改E:appproduct11.2.0dbhome_1NETWORKADMINtnsnames.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 ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

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

修改E:appproduct11.2.0dbhome_1NETWORKADMINtnsnames.ora文件,新增到虚拟机Oracle的连接内容:

# tnsnames.ora Network Configuration File:E:appproduct11.2.0dbhome_1NETWORKADMINtnsnames.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.558idc.com/topicnews.aspx?tid=12

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论