问题描述
- ORA-12504: TNS: 监听程序在CONNECT_DATA 中未获得SERVICE_NA
-
vs2015客户端C#连接服务器的Oracle数据库,提示ORA-12504: TNS: 监听程序在CONNECT_DATA 中未获得SERVICE_NA
解决方案
先在system用户下查一下你的数据库实例名是否为“orcl”?:
select value$ from sys.props$ where name='GLOBAL_DB_NAME';
listener.ora文件内容改成如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:appAdministratorproduct11.1.0db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:appAdministratorproduct11.1.0db_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.90)(PORT = 1521))
)
)
--tnsnames.ora内容:
LISTENERBOB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.90)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
解决方案二:
tnsping orcl 能ok吗?或者你该吧localhost改成Ip地址
时间: 2024-12-10 01:01:03