Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: DBI and Oracle ORA-12505 error

by Tux (Monsignor)
on May 13, 2013 at 14:52 UTC ( #1033301=note: print w/ replies, xml ) Need Help??


in reply to DBI and Oracle ORA-12505 error

Does tnsping help?

Have you tried connecting using the TWO_TASK variable? Is it set or unset?

What is the result of

# Note that the SID is case sensitive in Ora 11! my $dbh = DBI->connect ("dbi:Oracle:sid=jupiter;host=jupitercluster", "user", "pass", { RaiseError => 1, PrintError => 1, ChopBlanks => 1, ShowErrorStatement => 1, FetchHashKeyName => "NAME_lc", }) or die $DBI::errstr;

Enjoy, Have FUN! H.Merijn


Comment on Re: DBI and Oracle ORA-12505 error
Select or Download Code
Re^2: DBI and Oracle ORA-12505 error
by jmb (Novice) on May 13, 2013 at 15:42 UTC

    Thank you for your reply ! I apologize in advance for the French in the error messages below (all this is happening on a French Windows XP box).

    First of all, the TWO_TASK environment variable is not set in this Windows system. I have not tried to use it. Here is the output of the snippet that you suggested:
    C:\test>perl oracle_test.pl DBI connect('sid=JUPITER;host=jupitercluster','user',...) failed: ORA- +12505: TNS : le module d'écoute (listener) n'a pas pu résoudre le SID + donné dans le descripteur de connexion (DBD ERROR: OCIServerAttach) +at oracle_test.pl line 11
    As for tnsping, I guess that it gives a strong indication. Using it produces a TNS-03505 error for every single alias in the tnsnames.ora file ! This is strange because I can successfully use all the other tnsnames.ora aliases from within Perl/DBI, as well as using the Oracle SQL Developer client. I mean, except the one I am having a problem with, which does not work from within Perl/DBI, but *does* work using the Oracle SQL Developer client.
    c:\test> tnsping JUPITER or c:\test> tnsping jupiter TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on + 13-MAI-2013 17:17:40 Copyright (c) 1997 Oracle Corporation. All rights reserved. Fichiers de paramètres utilisés : C:\Oracle\network\admin\sqlnet.ora TNS-03505: Echec de la résolution du nom
    Here is the (short) content of sqlnet.ora:
    # Generated by our DBA NAMES.DEFAULT_DOMAIN = mycompany.com NAMES.DIRECTORY_PATH= (TNSNAMES)
    Any further suggestions ? Again, thanks a lot for your answer. And yes, learning about Oracle and Perl/Oracle is fun ;-)

      In your first code snippet, you are still using the uppercase SID. Try it lowercased!.

      tnsping works with the identifier, which most often is not the same as the SID.

      $ head -4 $ORACLE_HOME/network/admin/tnsnames.ora oradb_btest = ( DESCRIPTION = ( ADDRESS_LIST = ( ADDRESS = ( HOST = oradb )( PORT = 1521 )( PROTOCOL = TCP ))) ( CONNECT_DATA = ( SERVICE_NAME = basetest )) ) $ tnsping oradb_btest TNS Ping Utility for HPUX: Version 10.2.0.4.0 - Production on 13-MAY-2 +013 18:24:26 Copyright (c) 1997, 2007, Oracle. All rights reserved. Used parameter files: /prod/oracle/v102/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact ( DESCRIPTION = ( ADDRESS_LIST = ( ADDRESS = ( P +ROTOCOL = TCP)( PORT = 1521) ( HOST = oradb))) ( CONNECT_DATA = ( SER +VICE_NAME = basetest))) OK (90 msec) $

      Enjoy, Have FUN! H.Merijn
      /code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033301]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2014-11-24 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (137 votes), past polls