ORA-12154: TNS: 无法解析指定的连接标识符
我正在尝试连接到 Linux EL 5 上安装的 oracle 11g 并收到以下错误
SQL> connect sys/password@ud06 as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
我的 network/admin 下的listener.ora 如下
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=ud06)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/home/oracle/app/oracle/product/11g)
(SID_NAME=orcl))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/home/oracle/app/oracle/product/11g)
(PROGRAM=extproc)))
我的 tnsnames.ora 如下
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
UD06=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ud06)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
我的 lsnrctl 状态显示如下:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 17-FEB-2010 16:23:06
Uptime 0 days 0 hr. 12 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11g/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/product/11g/log/diag/tnslsnr/ud06/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "plsextproc" has 1 instance(s).
Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
I am trying to connect to oracle 11g installed on Linux EL 5 and and getting the following error
SQL> connect sys/password@ud06 as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
my listener.ora under network/admin is as follows
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=ud06)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/home/oracle/app/oracle/product/11g)
(SID_NAME=orcl))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/home/oracle/app/oracle/product/11g)
(PROGRAM=extproc)))
MY tnsnames.ora is as follows
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
UD06=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ud06)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
MY lsnrctl status shows as follows:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 17-FEB-2010 16:23:06
Uptime 0 days 0 hr. 12 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11g/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/product/11g/log/diag/tnslsnr/ud06/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "plsextproc" has 1 instance(s).
Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这个问题的答案很简单。不必担心 .ora 文件或任何其他配置。 Oracle 将所有这些都做得非常完美。
仅当通过命令行连接时,它才会与其中包含 @ 符号的密码混淆。
那是!!问题解决了。困扰我好几天了,现在问题解决了!!
The answer to this problem is very simple. Do not worry about the .ora files or any other configuration. Oracle does all these just perfect.
Only while connecting via command line, it gets confused with passwords that have a @ symbol in them.
That is!! Problem solved. I had been breaking my head for quite a few days, and now my problem is solved!!
您能否成功 ping ud06(作为 ud06,而不是 ud06.us.server.com)?
该命令
显示什么?
编辑:
在我看来,数据库实例名称可能实际上不是“orcl”? lsnrctl 服务输出告诉我的是“orcl”服务虽然在listener.ora 文件中定义,但实际上并未运行。
可以直接连接服务器登录吗?如果是这样,您使用什么作为 ORACLE_SID 环境变量值?以 SYS 用户身份登录并发出命令:
ALTER SYSTEM REGISTER;
然后再次发出 lsnrctl services 命令并查看是否未显示其他实例。
此外,正如 Alex 指出的那样,tnsping 命令正在报告完全限定的服务名称。编辑 sqlnet.ora 文件并将 NAMES.DEFAULT_DOMAIN 值设置为 NULL(如果有值)。
编辑 2:服务器上的 tnsping ud06 是否有效?或者我认为客户端和服务器位于不同系统上的假设是错误的?
Can you ping ud06 successfully (as ud06, not ud06.us.server.com)?
What does the command
show?
EDIT:
It sounds to me like maybe the database instance name isn't actually "orcl"? What the lsnrctl services output tells me is that the "orcl" service, although defined in the listener.ora file, is not actually running.
Can you log on with a direct connection on the server? If so, what do you use as the ORACLE_SID environment variable value? Log in as the SYS user and issue the command:
ALTER SYSTEM REGISTER;
Then issue the lsnrctl services command again and see if an additional instance doesn't show up.
Also, as Alex points out, the tnsping command is reporting a fully qualified service name. Edit the sqlnet.ora file and set the NAMES.DEFAULT_DOMAIN value to NULL if it has a value.
EDIT 2: Does tnsping ud06 on the server work? Or is my assumption that client and server are on different systems wrong?
tnsping
输出中的SERVICE_NAME
与tnsnames.ora
中的条目不匹配;该文件是来自 Windows 盒子还是 Linux 盒子?看起来您没有u06
的本地 (Windows)tnsnames.ora
条目,并且它猜测服务名称应该扩展它 - 我认为这就是引用主机名适配器的意思。The
SERVICE_NAME
in thetnsping
output doesn't match the entry intnsnames.ora
; is that file from the Windows box or the Linux box? It looks like you don't have a local (Windows)tnsnames.ora
entry foru06
and it's guessing what the service name should be expanding it - I think that's what the reference to the hostname adapter means.我还遇到了 ORA-12154: TNS: 无法解析指定的连接标识符,并添加尝试连接到 oracle 的 oinstall 组的用户修复了该问题。
I also run into ORA-12154: TNS:could not resolve the connect identifier specified, and adding the user trying to connect to the oinstall group of oracle fixed it.
首先尝试oracle实例是否启动:
对于windows:
开始->配置面板->启动管理工具->服务->ORACLESERVICEORCL(顺便说一下我的实例)->启动
first try whether the oracle instance is started :
for windows:
start->configuration panel-> administration touls->Services->ORACLESERVICEORCL(my instance by the way)->start
提供如下连接字符串:
ServerName:port/ServiceName;User Name;Password
Provide the connection string like this:
ServerName:port/ServiceName;User Name;Password
我也遇到了同样的错误,请尝试以下代码:
如果您发现相同的错误,则意味着您有不同的可插入数据库名称。
只需在
sqlplus
中编写以下命令即可检查可插入数据库名称I was also facing the same error, try this code:
and if you find same error, it means that you have a different pluggable database name.
Check the pluggable database name by just writing the following command in
sqlplus
我使用以下步骤解决了这个问题。
首先,如果您没有安装相同的目录或驱动器,则会发生此错误。
但答案就在这里。
查找操作系统变量并将名称更改为“TNS_ADMIN”
并将值更改为“tnsnames 的目录地址”
重新启动系统。
I fixed this problem using this steps.
First of all, this error occured , if you didn't install same directory or drive.
But the answer is here.
Find the OS variable and change name as a "TNS_ADMIN"
And change the value as a "tnsnames's directory address"
Restart the system.