ORA-12504: TNS:listener 在 CONNECT_DATA 中没有被赋予 SERVICE_NAME [英] ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
问题描述
我正在尝试使用 Visual Studio 2010 中的服务器资源管理器连接我的本地 Oracle 11g 数据库.我尝试按照说明设置所有内容,但我仍然收到 ORA-12504 错误.
I'm trying to connect my local Oracle 11g database using server explorer in Visual Studio 2010. I tried to setup everything as per instruction, but I'm still getting an ORA-12504 error.
这里是错误:
这是我的 tnsnames.ora 内容:
Here is my tnsnames.ora contents:
# tnsnames.ora Network Configuration File: C:app
sahiproduct11.2.0dbhome_1
etworkadmin nsnames.ora
# Generated by Oracle configuration tools.
VENUS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SPRPRG020)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = VENUS)
)
)
LISTENER_VENUS =
(ADDRESS = (PROTOCOL = TCP)(HOST = SPRPRG020)(PORT = 1521))
listener.ora 文件内容,
listener.ora file contents,
# listener.ora Network Configuration File: C:app
sahiproduct11.2.0dbhome_1
etworkadminlistener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = SPRPRG020)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:app
sahi
推荐答案
我在尝试使用 Oracle 11g 创建 LinkedServer 时遇到了同样的问题.我的 oracle 实例名称是:PC-2.my.xgen,我的侦听器名称是NB".第一条语句的最后一个参数实际上是 Oracle 服务器实例和侦听器名称的串联.
I have experienced the same problem when I was trying to create LinkedServer with Oracle 11g. My oracle instance name was: PC-2.my.xgen and my listener name was "NB". The last parameter of first statement is actually the concatenation of Oracle server instance and listener name.
所以我在 SQL Server 中写下了以下语句.
So I have write down the following statements in SQL server.
--add a linked server into SQL server
--last parameter contains OracleInstance / Listener Name of desired database
EXEC sp_addlinkedserver 'OracleLinkedServer4', 'Oracle', 'MSDAORA', 'PC-2.my.xgen/nb'
--add login information into linked server
EXEC sp_addlinkedsrvlogin 'OracleLinkedServer4', false, Null, 'system', '123456'
在 Oracle 数据库NB"中,我有一个名为:CRD_CIL_NOTIFICATION_TYPE 的表.所以我写了下面的语句来获取记录.
In Oracle database "NB" I have a table named : CRD_CIL_NOTIFICATION_TYPE. So I have written down the following statement to get the records.
select * from OracleLinkedServer4..SYSTEM.CRD_CIL_NOTIFICATION_TYPE
这篇关于ORA-12504: TNS:listener 在 CONNECT_DATA 中没有被赋予 SERVICE_NAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!