Discuz教程网

求助:TNS:could not resolve service name

[复制链接]
authicon 李朱 发表于 2010-10-26 09:11:42 | 显示全部楼层 |阅读模式

大家好,为什么我用某个数据库帐号登录数据库就会出现如下问题:
Enter user-name: lishaowen@ora9i2
Enter password:
ERROR:
ORA-12154: TNS:could not resolve service name
但用别的帐号登录就没问题呢?
待复,感谢!



上一篇:请教个关于显示的偏门问题
下一篇:能否讨论个问题? oracle导数据到MySql的问题,以Job的方式
authicon wodi1015 发表于 2010-10-26 09:29:15 | 显示全部楼层

你的用户名带有@ 不知道有没有关系
authicon duolanshizhe 发表于 2010-10-26 09:41:44 | 显示全部楼层

恩   你能确认不同用户是连接相同的库么
比较怪异
authicon renxiao2003 发表于 2010-10-26 10:13:45 | 显示全部楼层

ora9i2
这个服务名存在吗?
authicon ldxm8848 发表于 2010-10-26 11:05:47 | 显示全部楼层

存在的,别的用户可以
ora9i2是正确的实例名的。。郁闷啊……
authicon tacsoft 发表于 2010-10-26 11:32:10 | 显示全部楼层

问题:TNS:无法解析指定的连接标识符
ORA-12154: TNS:could not resolve the connect identifier specified
原因:
连接到数据库或其它服务需要使用一个连接符(identifier),指定连接标识符不能解析到使用一种配置命名方法的连接描述符。比如:如果这种类型的连接标识符使用的是网络服务名,这个网络服务名不能在名称库中被找到,也许这个库不在本地,或者不可达。
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
方法:
如果你使用本地名称(TNSNAMES.ORA 文件)
(- If you are using local naming (TNSNAMES.ORA file):)
确认在"TNSNAMES" 是Oracle Net profile (SQLNET.ORA)的NAMES.DIRECTORY_PATH parameter参数中的一个值。
(- Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA))
检查TNSNAMES.ORA文件是否存在,它所在的目录是否正确和可访问。
(- Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.)
检查网络服务名,作为连接标识符在tnsnames.ora文件中存在。
(- Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.)
确认TNSNAMES.ORA文件中没有语法错误。找出不匹配的括号或错误的字符。TNSNAMES.ORA文件中存在错误可能导致其不能使用。
(- Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.)
几个建议:
1)假设是客户机服务器方式,你的客户机首先要能够ping通服务器。
2)客户机上正确安装了Oracle客户端软件。
3)服务器上的监听器配置正确,假设自己手工写TNSNAMES.ORA文件没有经验,建议你使用Netca工具生成监听器。
4)使用命令tnsping 服务名,测试客户端到服务器的通信,测试结果告诉你是否连通,服务器的主机地址(IP)或名称,服务名等内容。
5)连接命令格式:sqlplus 用户名/密码@服务器地址(IP)/服务名。假设是管理员,需要在后面加上as 角色名。
6)假设是一般用户,这个用户应该具有一定的权限,刚创建的用户假设没有授予权限也是连不通的。
authicon ldxm8848 发表于 2010-10-26 11:45:32 | 显示全部楼层

是密码带有@造成的,修改密码可以成功了,谢谢!
authicon duolanshizhe 发表于 2010-10-26 12:39:41 | 显示全部楼层

晕死   假设有@的话  oracle自动把@之后的字符解析成  本地服务器名
这样就会导致解析失败  哈哈哈   这个问题比较有意思   没有考虑到   
authicon duolanshizhe 发表于 2010-10-26 13:09:22 | 显示全部楼层

不过话又说来啊
创建用户的时候  直接给定口令包含@是不允许的啊,需要双引号包括起来 ,因此 连接的时候也需要双引号!
SQL> create user t identified by test@test;
create user t identified by test@test
                                *
ERROR at line 1:
ORA-00922: missing or invalid option
SQL>  create user t identified by "test@test";
User created.
SQL> grant dba to t;
Grant succeeded.
SQL> conn t/test@test;
ERROR:
ORA-12154: TNS:could not resolve service name
Warning: You are no longer connected to ORACLE.
SQL> conn t   
Enter password:
ERROR:
ORA-12154: TNS:could not resolve service name
SQL> conn t/"test@test"
Connected.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 20:31

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表