RE: Having a problem conneting to an Oracle 11gr2 RAC

[email protected] (John Scoles)
Newsgroups perl.dbi.users
Message-ID <[email protected]>

 It is somthing in you connection string or you do not have the TNS_ADMIN env car set 

 

TNS_ADMIN should point to your TNSNAMES.ORA file

 

 
> Subject: Having a problem conneting to an Oracle 11gr2 RAC
> Date: Thu, 29 Apr 2010 15:03:18 -0500
> From: [email protected]
> To: [email protected]
> 
> Don't know if anyone has worked with the Oracle RAC environment and
> perl.
> 
> Using sqlplus, I can do the following
> 
> C:\>sqlplus ais_dbo/PASSWORD@edc-dbserver/HCSMDA
> 
> SQL*Plus: Release 10.2.0.1.0 - Production on Thu Apr 29 11:55:35 2010
> 
> Copyright (c) 1982, 2005, Oracle. All rights reserved.
> 
> Connected to:
> Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
> Production
> With the Partitioning, Real Application Clusters, Automatic Storage
> Management, OLAP,
> Data Mining and Real Application Testing options
> 
> And then execute queries, updates ...
> 
> From ActiveState perl running on a windows 2003 server box with
> DBD-Oracle 1.21 and DBI 1.609
> 
> C:\>perl -v
> 
> This is perl, v5.8.9 built for MSWin32-x86-multi-thread (with 9
> registered patches, see perl -V for more detail)
> 
> Copyright 1987-2008, Larry Wall
> 
> Binary build 825 [288577] provided by ActiveState
> http://www.ActiveState.com
> Built Dec 14 2008 21:07:41
> 
> Perl code follows
> 
> #!/usr/bin/perl -I .
> require 5.001;
> use strict;
> use DBI;
> 
> MAIN:
> {
> print "Started\n";
> 
> my $dbh = DBI->connect("dbi:Oracle:host=edc-dbserver;sid=HCSMDA",
> "ais_dbo","PASSWORD", 
> {RaiseError=>1, PrintError=>0});
> my $sqlstmt = "SELECT COUNT(*) FROM VESSEL_IDENTIFIERS";
> my($no_of_ships) = $dbh->selectrow_array($sqlstmt); 
> print "Got $no_of_ships ships\n"
> }
> 
> Executing the above, I get 
> 
> Started
> DBI connect('host=edc-dbserver;sid=HCSMDA','ais_dbo',...) failed:
> ORA-12505: TNS:listener does not currently know of SID given in connect
> descriptor (DBD ERROR: OCIServerAttach) at C:\adbtest.pl line 15
> 
> I've got a standalone oracle database (11gr1) pointed to by host alias
> dbserver. If I use dbserver above instead of edc-dbserver, the script
> works fine.
> 
> Also, tnsping gives the following
> 
> C:\>tnsping edc-dbserver
> 
> TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on
> 29-APR-2010 12:57:46
> 
> Copyright (c) 1997, 2005, Oracle. All rights reserved.
> 
> Used parameter files:
> C:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
> 
> Used HOSTNAME adapter to resolve the alias
> Attempting to contact
> (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=edc-dbserver.nais.org))(ADDRESS
> =(PROTOCOL=TCP)(HOST=10.166.135.110)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(
> HOST=10.166.135.112)(PORT=1521)))
> OK (0 msec)
> 
> Any help would be greatly appreciated.
> 
> E. Scott Stricker
> Senior Software Engineer
> Northrop Grumman - Information Systems - C2SD 
> MailStop 4S02
> 2340 Dulles Corner Blvd.
> Herndon, VA 20171
> 703-561-3671
> 703-713-1601 (fax) 
> 
> 
 		 	   		  
_________________________________________________________________
Live connected. Get Hotmail & Messenger on your phone.
http://go.microsoft.com/?linkid=9724462
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.