PL/SQL连接Oracle数据库的时候 报”ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务” 错误
本例原因:
安装Oracle时一般默认实例都是orcl,发现有人不按套路出牌,改了名字,如图
解决方法:
在Oracle安装目录 找到listener.ora文件 路径为 D:/oracle/product/11.2.0/dbhome_1/NETWORK/ADMIN
(根据自己情况查找) 修改:
# listener.ora Network Configuration File: D:/oracl/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
(ENVS = “EXTPROC_DLLS=ONLY:D:/oracle/product/11.2.0/dbhome_1/bin/oraclr11.dll”)
)
(SID_DESC =
(GLOBAL_DBNAME = JTW)
(ORACLE_HOME = D:/oracle/product/11.2.0/dbhome_1)
(SID_NAME = JTW)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
红色部分为新添加内容,JTW为监听的实例名
然后修改(添加)instantclient_11_2/network/admin/tnsnames.ora
MyOracle =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = jtw)
)
)
重启Oracle监听
参考资料:链接
作者:itmyhome
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/database/4105.html