Bruce,

Using the oracle 11g sqlplus and the TNS_ADMIN set to the same location as the perl script, can you connect to the alias you are trying with the perl script on said box?

check the sqlnet.ora for NAMES.DEFAULT_DOMAIN. Make sure that matches the domain in the tnsnames.ora alias.

That's all I can come up with at the moment.

Regards,

Michael

On Wed, 30 Jul 2008, Bruce Johnson wrote:

Date: Wed, 30 Jul 2008 10:00:54 -0700
From: Bruce Johnson <[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: Weird TNS error with DBI::Oracle 1.21 & oracle 11G


On Jul 29, 2008, at 8:55 PM, Jeffrey Seger wrote:

Standard troubleshooting applies:
1. Are you running the script as the same user? and with the same
environment? (If you are running it in a webserver probably not).

Yes. Moreover, setting them explicitly in the script (via the ENV statements) did not fix the issue. The same script runs just fine on our older system.


2. Is this running under apache?  If so, are the same environment variables
being set in httpd.conf?  Or are the old 8.1.6 variables there maybe?

We tried setting the env vars in apache, also no go.


3. Try running the script with the following code inserted near the
beginning:
 foreach my $key (sort keys %ENV){ print "$key=$ENV{$key}\n"} (add in a
<br> if running through a webserver)
   Compare the output to `env|sort` when run by the user you are using
tnsping as.

After cutting irrelevant env vars, this is what prints:

[EMAIL PROTECTED]:~/perl/frs> env |sort

LD_LIBRARY_PATH=/home/oracle/product/11.1.0/db_1/lib
ORACLE_BASE=/home/oracle
ORACLE_HOME=/home/oracle/product/11.1.0/db_1
ORACLE_SID=phmweb
TNS_ADMIN=/home/oracle/product/11.1.0/db_1/network/admin

[EMAIL PROTECTED]:~/perl/frs> ./testdbi.pl

LD_LIBRARY_PATH=/home/oracle/product/11.1.0/db_1/lib
ORACLE_BASE=/home/oracle
ORACLE_HOME=/home/oracle/product/11.1.0/db_1
ORACLE_SID=phmweb
TNS_ADMIN=/home/oracle/product/11.1.0/db_1/network/admin

DBI connect('phmweb.pharmacy.arizona.edu','people',...) failed: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach) at ./testdbi.pl line 11 Database connection not made: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach) at ./testdbi.pl line 11.

This is why it's driving me nuts. This is identical to the environment where tnsping works. Fortunately I can get around it by bypassing TNS and specifying the 'host=host:port;sid=sid' directly in the connection string, but I'd like to know what's wrong.

The question may be academic anyway, I've been told we're nuking and re-building the server all over again as an exercise anyway. If it recurs, I know how to fix it.



--
                ---//---
Time flies like the wind. Fruit flies like bananas.
        --- Groucho Marx

Either write something worth reading or do something worth writing.
        --- Benjamin Franklin

Reply via email to