More Oracle 0x80004005 errors with linked server
Yeah… Oracle sucks.
For some reason, I was continuing to get the famous 0x80004005 error even after I got everything to work. When the computer started up, I could perform queries to the linked Oracle server. After a little while though, it would start throwing errors at me and for no reason whatsoever. I searched all over and couldn’t find a solution, so I found it on my own. Here’s what I did.
First thing I did was look at my tnsnames.ora file to see what my configuration was, below is what it looked like (hostnames changed to protect the innocent):
(ADDRESS = (PROTOCOL = TCP)(HOST = erpdev1.EXAMPLE.COM)(PORT = 1521))
(SERVICE_NAME = fdev)
My sqlnet.ora file was also setup correctly with:
NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME)
Now I could ping erpdev1.example.com and if I ran Net Configuration Assistant I would pass the connection test to fdev.example.com. Thing was though I couldn’t perform a tnsping to fdev.example.com for some reason. On a hunch I opened up my hosts file (c:\windows\system32\drivers\etc) and added an entry. I mapped fdev.example.com to the same ip as erpdev1.example.com and saved. Tried again and everything worked!
To sum up, if you run into this weird problem just add an entry into your hosts file to point your service name to the same ip address as your host.
I ran into this problem again. It seems like many things cause it. This time I received error #7399. The trick into solving this one for me was to open up my SQLNET.ORA file and to comment my NAMES.DEFAULT_DOMAIN section. Seems that this was confusing oracle when accessing the service name.
Now while commenting out the line fixed my problem. You may have to add something to it. Point is to just make sure it is correct. You will know by trying to make a connection through SQLPLUS and if you get an error complaining that it cannot access the service name, you know the problem.