service name 配的不对.
ORA-12154 TNS:could not resolve service name Cause The service name specified is not defined correctly in the TNSNAMES.ORA file. 
Action Make the following checks and correct the error: ?Verify that a TNSNAMES.ORA file exists and is in the proper place and accessible. See the operating system specific manual for details on the required name and location.
?Check to see that the service name exists in one of the TNSNAMES.ORA files and add it if necessary.
?Make sure there are no syntax errors anywhere in the file. Particularly look for unmatched parentheses or stray characters. Any error in a TNSNAMES.ORA file makes it unusable. See Chapter 4 in the SQL*Net V2 Administrator's Guide. If possible, regenerate the configuration files using the Oracle Network Manager. Copyright (C) 1998, Oracle Corporation

解决方案 »

  1.   

    ORA-12154 TNS:could not resolve service name
    Cause: The service name specified is not defined correctly in the TNSNAMES.ORA file.Action: Make the following checks and correct the error: Verify that a TNSNAMES.ORA file exists and is in the proper place and accessible. See the operating system specific manual for details on the required name and location. Check to see that the service name exists in one of the TNSNAMES.ORA files and add it if necessary. Make sure there are no syntax errors anywhere in the file. Particularly look for unmatched parentheses or stray characters. Any error in a TNSNAMES.ORA file makes it unusable. See the Oracle Net Services Administrator's Guide. If possible, regenerate the configuration files using the Oracle Network Manager
      

  2.   

    感谢两位给出12154错误资料的朋友!
    12154的错误确实是因为系统解析不了service name造成的,我运行sqlplus能正确登录,是否说明tnsnames.ora应该没错?如果不是,请大家能根据我贴出的tnsnames.ora文件内容帮我指出一下!
    下周一前结分,绝不食言,回复的朋友请到时注意,如果发现没有得分请联系小弟!
    非常感谢大家!
      

  3.   

    另外有个细节,如果是service name没有配对,为什么在solaris下直接运行该cgi程序不会报12154的错误并且能从数据库得到正确结果?
      

  4.   

    如果你进入sql*plus时没有输入“主机字符串”(即你是在数据库服务器上操作),则不能说明tnsnames.ora是否正确,先确认服务器端的OracleOraHome81TNSListener服务以启动
    NET8配置全过程:
    1.在'新的网络服务名'里随便填一个名字
    2.一直点"下一步"
    3."主机名"填你的服务器名字或它的ip地址
    4."服务名"填 你要联的数据库名.域名
    5.测试一下,出现成功信息就行了
      

  5.   

    ******************
    回复人: bzszp(SongZip)
      如果你进入sql*plus时没有输入“主机字符串”(即你是在数据库服务器上操作),则不能说明tnsnames.ora是否正确,
    ******************有输在tnsnames.ora中配置的主机字符串,程序里面连接数据库时也有输:“用户名/密码@主机字符串”。******************
    先确认服务器端的OracleOraHome81TNSListener服务以启动
    ******************运行lsnrctl,先stop,然后start,也试过。******************
    NET8配置全过程:
    1.在'新的网络服务名'里随便填一个名字
    2.一直点"下一步"
    3."主机名"填你的服务器名字或它的ip地址
    4."服务名"填 你要联的数据库名.域名
    5.测试一下,出现成功信息就行了
    ******************windows端有net8 config工具,solaris下我一直是直接vi tnsnames.ora文件,请问你说的配置是通过哪个命令来做的?
    不胜感激!