oracle – 为什么sqlplus没有连接?
我的目标是从OS X机器连接到Oracle 9i实例.我按照设置说明
here进行了操作,没??有错误(最终).但是,我发现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. 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: 我的tnsnames.ora文件…… zzz = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = dbhost) (PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = zzz) ) ) 也许有一个需要设置的env变量? UPDATE 能ping数据库主机没问题. 试了… sqlplus xxx/yyy@//dbhost/zzz 拿到… ERROR: ORA-12170: TNS:Connect timeout occurred 在tnsnames.ora中尝试使用SID而不是SERVICE_NAME.似乎没有改变结果.恢复为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 nt secondary err code: 60 nt OS err code: 0 部分答案 谢谢大家的回答.他们很有帮助.我发现存在DNS问题.我能够通过主机名ping,所以认为应该正常工作.我也试过I.P.地址.原来我需要内部的“10.1.x.x”I.P.它可以在这个OS X机器上运行的地址(但是Windows上的主机名很好). 此时,我可以与…联系 sqlplus xxx/yyy@//INTERNAL_IP/zzz 但是,将这些值输入到tnsnames.ora中,这仍然不起作用…… sqlplus xxx/yyy@zzz … ORA-12154: TNS:could not resolve the connect identifier specified 我搜索了一个接近我需要的样本tnsnames.ora文件,并将内容复制到我的文件中.改变了参数,现在一切正常.不知道为什么我的不工作. 由于您使用的是10g客户端,因此建议使用Easy Connect语法:export TWO_TASK=//dbhost/zzz sqlplus xxx/yyy ,或者只是这样: sqlplus 'xxx/yyy@//dnhost/zzz' 还要检查ORACLE_HOME指向正确的文件夹:在$ORACLE_HOME / network / admin / tnsnames.ora中搜索tnsnames.ora (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |