$ echo $TWO_TASK
dbo_xyz0123
$ perl -ne'/^$ENV{TWO_TASK}\b/ .. /^$/ and print' $ORACLE_HOME/network
+/admin/tns
names.ora
dbo_xyz0123 = ( DESCRIPTION = ( ADDRESS_LIST =
( ADDRESS = ( HOST = dbo )( PORT = 1521 )( PROTOCOL = TCP )))
( CONNECT_DATA = ( SERVICE_NAME = xyz0123 )))
$ tnsping $TWO_TASK
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 29-NOV-
+2018 14:38:39
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/pro/oracle/v11.2/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact ( DESCRIPTION = ( ADDRESS_LIST = ( ADDRESS = ( H
+OST = dbo)( PORT = 1521)( PROTOCOL = TCP))) ( CONNECT_DATA = ( SERVIC
+E_NAME = xyz0123)))
OK (620 msec)
$
And then simplify your perl code to
use DBI;
my $dbh = DBI->connect ("dbi:Oracle:", $user, $pass, { RaiseError => 1
+, PrintError => 1});
If part one fails, part 2 will fail too and doesn't need debugging. If part 1 succeeds, *then* you need to start digging
Enjoy, Have FUN! H.Merijn
|