3 回答
TA贡献1865条经验 获得超7个赞
我遇到了这个问题,解决方法是确保中tnsnames.ora的SERVICE_NAME数据库中的服务名称有效。要查找有效的服务名称,可以在oracle中使用以下查询:
select value from v$parameter where name='service_names'
一旦我更新tnsnames.ora为:
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = *<validhost>*)(PORT = *<validport>*))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = *<servicenamefromDB>*)
)
)
然后我跑了:
sqlplus user@TEST
成功!监听程序基本上是在告诉您,根据数据库,您正在使用的任何service_name都不是有效的服务。
TA贡献1890条经验 获得超9个赞
我知道这是一个老问题,但仍然没有答案。我花了一天的时间进行研究,但我找到了最简单的解决方案,至少就我而言(在Windows 2008 R2上为Oracle 11.2),并且希望共享。
如果直接查看该错误,则表明侦听器无法识别服务名称。但是它在哪里保留服务名称?在%ORACLE_HOME%\NETWORK\ADMIN\listener.ora
“ SID_LIST”就是这样,以可复制或查找的格式配对的SID和服务名称列表。
我添加了问题“服务名称”,然后在Windows“服务”控制面板中对Oracle侦听器服务进行了“重新启动”。现在一切都很好。
例如,您的listener.ora文件最初可能看起来像:
# listener.ora Network Configuration File: C:\app\oracle_user\product\12.1.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\oracle_user\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle_user\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
...并使其能够识别服务名称orcl,您可以将其更改为:
# listener.ora Network Configuration File: C:\app\oracle_user\product\12.1.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\oracle_user\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle_user\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = C:\app\oracle_user\product\12.1.0\dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
TA贡献1801条经验 获得超16个赞
在我的情况下,错误是由于侦听器未注册数据库服务而造成的。我通过注册服务解决了这个问题。例:
我的描述符在tnsnames.ora:
LOCALDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = LOCALDB)
)
)
因此,我继续listener.ora手动注册服务:
SID_LIST_LISTENER =
(SID_DESC =
(GLOBAL_DBNAME = LOCALDB)
(ORACLE_HOME = C:\Oracle\product\11.2.0\dbhome_1)
(SID_NAME = LOCALDB)
)
最后,通过命令重新启动侦听器:
> lsnrctl stop
> lsnrctl start
做完了!
- 3 回答
- 0 关注
- 3591 浏览
添加回答
举报