Re: Weird TNS error with DBI::Oracle 1.21 & oracle 11G



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 <johnson@xxxxxxxxxxxxxxxxxxxx>
To: dbi-users@xxxxxxxx
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:

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.



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

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



Relevant Pages

  • [NEWS] IBM Informix Web DataBlade Local Root by Design
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... that ease development of "intelligent", interactive, Web-enabled database ... person who has access to change the Perl script. ...
    (Securiteam)
  • perl, oracle, sendmail and Solaris 10
    ... to an email alias on a Solaris 10 machine. ... This script uses Oracle ... having problems getting this script to work with the alias. ...
    (SunManagers)
  • SUMMARY: perl, oracle, sendmail and Solaris 10
    ... changing the permissions on the ORACLE_HOME files to 755 shouldn't be a ... After discussing with our Oracle admins, ... We have a perl script that gets executed when users send email ... having problems getting this script to work with the alias. ...
    (SunManagers)
  • my perl script for ripping mp3s...aka MP3scRIPt
    ... This is a Perl script to convert audio cd tracks to mp3s. ... Possibly root privs to access the cdrom device ... - this is mainly a problem on 'variety cds', mp3 files suffering from this ill ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Perl script to mimic uniq
    ... mdfoster44@netscape.net spits TOFU in my face: ... > # Perl script to find most common CS ... > So I'm back to my original script which looks like this. ... > identify a sequence as unique. ...
    (comp.lang.perl)