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:

oracle@tonic2:~/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

oracle@tonic2:~/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; kludge it, rather, not fixing the underlying problem.

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs


.



Relevant Pages

  • Re: Weird TNS error with DBI::Oracle 1.21 & oracle 11G
    ... (If you are running it in a webserver probably not). ... are the same environment variables ... Try running the script with the following code inserted near the ... Environment variables should be set prior to running the script. ...
    (perl.dbi.users)
  • Re: Weird TNS error with DBI::Oracle 1.21 & oracle 11G
    ... (If you are running it in a webserver probably not). ... setting them explicitly in the script did not fix the issue. ... Database connection not made: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor at ./testdbi.pl line 11. ... This is identical to the environment where tnsping works. ...
    (perl.dbi.users)
  • Re: Possible to define a variable for only certain directories?
    ... allows such customizations upon the environment on a per- ... this is useful only if the user or script ... configuration files, environment variables, command line options, and ... commands to the CDE Window Manager from a shell ...
    (comp.unix.shell)
  • RE: local admin account password
    ... environment, yes we may have these, but we still use the same methods. ... With regards to the script, this script is actually run from a secured ... The local passwords are secured both in a secure password ...
    (Focus-Microsoft)
  • Re: Script for your enjoyment
    ... Another environment specific aspect. ... I do not maintain any databases ... The script should do that for you. ... isn't anyone checking if a domain group exists before they add it". ...
    (microsoft.public.scripting.wsh)