Eth*_*han 7 oracle macos sqlplus ora-12170
我的目标是从OS X机器连接到Oracle 9i实例.我按照这里的设置说明进行了操作,没有错误(最终).但是,我发现sqlplus无法连接:
[ ethan@gir ~ ]$ sqlplus xxx/yyy@zzz
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 17 10:13:08 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Run Code Online (Sandbox Code Playgroud)
Looooong等待......
ERROR:
ORA-12170: TNS:Connect timeout occurred
Enter user-name: xxx
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
Run Code Online (Sandbox Code Playgroud)
我的tnsnames.ora档案......
zzz =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = dbhost)
(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = zzz)
)
)
Run Code Online (Sandbox Code Playgroud)
也许有一个需要设置的env变量?
UPDATE
能ping数据库主机没问题.
试了...
sqlplus xxx/yyy@//dbhost/zzz
Run Code Online (Sandbox Code Playgroud)
拿到...
ERROR:
ORA-12170: TNS:Connect timeout occurred
Run Code Online (Sandbox Code Playgroud)
尝试使用SID而不是SERVICE_NAME在tnsnames.ora中.似乎没有改变结果.回到了SERVICE_NAME.
sqlnet.log中的最后几个条目...
***********************************************************************
Fatal NI connect error 12170.
VERSION INFORMATION:
TNS for MacOS X Server: Version 10.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for MacOS X Server: Version 10.2.0.4.0 - Production
Time: 17-APR-2009 10:33:06
Tracing not turned on.
Tns error struct:
ns main err code: 12535
TNS-12535: Message 12535 not found; No message file for product=network, facility=TNS
ns secondary err code: 12560
nt main err code: 505
TNS-00505: Message 505 not found; No message file for product=network, facility=TNS
nt secondary err code: 60
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12170.
VERSION INFORMATION:
TNS for MacOS X Server: Version 10.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for MacOS X Server: Version 10.2.0.4.0 - Production
Time: 17-APR-2009 11:24:08
Tracing not turned on.
Tns error struct:
ns main err code: 12535
TNS-12535: Message 12535 not found; No message file for product=network, facility=TNS
ns secondary err code: 12560
nt main err code: 505
TNS-00505: Message 505 not found; No message file for product=network, facility=TNS
nt secondary err code: 60
nt OS err code: 0
Run Code Online (Sandbox Code Playgroud)
部分答案
谢谢大家的回答.他们很有帮助.我发现存在DNS问题.我能够通过主机名ping,所以认为应该正常工作.我也试过IP地址.原来我需要内部的 "10.1.xx"IP地址才能在这台OS X机器上运行(但主机名在Windows上很好).
此时,我可以与...联系
sqlplus xxx/yyy@//INTERNAL_IP/zzz
Run Code Online (Sandbox Code Playgroud)
但是,将这些值输入到tnsnames.ora中,这仍然不起作用......
sqlplus xxx/yyy@zzz
Run Code Online (Sandbox Code Playgroud)
...
ORA-12154: TNS:could not resolve the connect identifier specified
Run Code Online (Sandbox Code Playgroud)
我搜索了一个接近我需要的样本tnsnames.ora文件,并将内容复制到我的文件中.改变了参数,现在一切正常.不知道为什么我的工作不起作用.
由于您使用的是10g客户端,因此建议使用Easy Connect语法:
export TWO_TASK=//dbhost/zzz
sqlplus xxx/yyy
Run Code Online (Sandbox Code Playgroud)
或者只是这个:
sqlplus 'xxx/yyy@//dnhost/zzz'
Run Code Online (Sandbox Code Playgroud)
还要检查您的ORACLE_HOME点到正确的文件夹:tnsnames.ora搜索到$ORACLE_HOME/network/admin/tnsnames.ora
| 归档时间: |
|
| 查看次数: |
81345 次 |
| 最近记录: |