Oracle (0x80004005)ORA-12154: TNS:could not resolve the connect identifier

梦想的初衷 提交于 2019-12-01 03:42:31

It seems all the settings have been checked but here is my suggestions for some trouble shooting:

  • How about restrictions on the account IIS is running under? Does it have the file permissions to read the TNSNAMES? Have you tried to give the user more rights. Even run IIS with Local As System Account? Remember to put it back the way it was.
  • You are sure there is not 3rd party app such anti virus or firewall that could influence / block access. (Disable them to test but do not forget to re-enable :)

(What did you finally do to solve it?)

"this works on a co-worker machine but not mine."

ORA-12154 is usually a configuration issue, and it would certainly seem to be so in your case. The short answer is to compare your machine with your colleague's one and figure out what the difference is.

Things to check include:

  • the TNANAMES.ORA file
  • the SQLNET.ORA file
  • the LISTENER.ORA file (if you're using a local database)

Do you have multiple Oracle homes? Check that IIS doesn't point to the other ORA_HOME (and thereby not finding your tnsnames.ora entry). I'm not very familiar with IIS configuration, so I would test this by adding the TNS entry to all tnsnames.ora on my PC.

If you are running a 64-bit OS and oracle 10 try installing all the patches for oracle. Something similar happened to me, SQL plus and all else worked, except my .NET program. I was running a .Net program out of the "Program files (x86)" folder. Installing patches fixed it.

The likely problem is the lack of read permission upon the Oracle directories by the User IIS is running-as.

As @Derick says, temporarily set the permissions wide-open on the $ORACLE_HOME directory (Everyone = Full Control), restart IIS, and test. When that works, give the IIS User read permission against that directory.

You can also confirm this issue using Process Monitor from Microsoft SysInternals, and seeing the failure message during the CreateFile(...) API call to open the DLLs or read the TNSNAMES.ORA file. Given the way temporary files work when selecting through cursors, you may also need to give the IIS user write permissions into some directories.

Try setting the value of the environment variable TNS_ADMIN on the machine with the problem to /network/admin (or wherever your tnsnames.ora file lives) and see if that helps.

I had the similar problem and found a simple solution. You don't have to modify any config files. Hope this can help you:

CREATE DATABASE LINK server2_db
  CONNECT TO dbuser IDENTIFIED BY pwd USING
 '(DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = server_2)(PORT = port_num))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = server2_db)
   )
 )';

The solution is from here:http://oraclequirks.blogspot.com/2008/11/ora-12154-tnscould-not-resolve-service.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!