同事遇到的问题,在其他电脑用PLSQL可以访问数据库,但他本机用PLSQL登陆时ORA-12154: TNS: could not resolve service name错误.我按照习惯查看了tnsnames.ora文件和监听配置文件,没发现问题.然后我详细的问了一下他安装数据库的步骤,然后查看了sqlnet.ora文件,找到了问题根本所在.
他的NAMES.DIRECTORY_PATH= (ONAMES),所以我把的此项修改为NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, ONAMES)
再连数据库,一切OK!
最后如果还不能解决问题请参考以下步骤:
1.Verify that a tnsnames.ora file exists.(See Also: "Localized Configuration File Support" for configuration file location information)
2.Verify that there are not multiple copies of the tnsnames.ora file.
3.In the tnsnames.ora file, verify that the net service name specified in your connect string is mapped to a connect descriptor.
4.Verify that there are no duplicate copies of the sqlnet.ora file.
5.If you are using domain names, verify that your sqlnet.ora file contains a NAMES.DEFAULT_DOMAIN parameter. If this parameter does not exist, you must specify the domain name in your connect string.
6.If you are not using domain names, and this parameter exists, delete it or disable it by commenting it out.
7.If you are connecting from a login dialog box, verify that you are not placing an "@" symbol before your connect net service name.
8.Activate client tracing and repeat the operation.
他的NAMES.DIRECTORY_PATH= (ONAMES),所以我把的此项修改为NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, ONAMES)
再连数据库,一切OK!
最后如果还不能解决问题请参考以下步骤:
1.Verify that a tnsnames.ora file exists.(See Also: "Localized Configuration File Support" for configuration file location information)
2.Verify that there are not multiple copies of the tnsnames.ora file.
3.In the tnsnames.ora file, verify that the net service name specified in your connect string is mapped to a connect descriptor.
4.Verify that there are no duplicate copies of the sqlnet.ora file.
5.If you are using domain names, verify that your sqlnet.ora file contains a NAMES.DEFAULT_DOMAIN parameter. If this parameter does not exist, you must specify the domain name in your connect string.
6.If you are not using domain names, and this parameter exists, delete it or disable it by commenting it out.
7.If you are connecting from a login dialog box, verify that you are not placing an "@" symbol before your connect net service name.
8.Activate client tracing and repeat the operation.