[oracle@yyjk sbin]$ time perl testdbi3.pl
DBI connect('//10.3.249.22:1521/tllspj','cips',...) failed: ORA-12541: TNS: 无监听程序 (DBD ERROR: OCIServerAttach) at testdbi3.pl line 14.
-------------------
11111111111111
real 0m0.125s
user 0m0.107s
sys 0m0.016s
[oracle@yyjk sbin]$ time perl testdbi3.pl
DBI connect('//10.2.120.192:1521/uacdb','uac',...) failed: ORA-12170: TNS: 连接超时 (DBD ERROR: OCIServerAttach) at testdbi3.pl line 15.
-------------------
11111111111111
real 1m0.181s
user 0m0.107s
sys 0m0.013s
You have mail in /var/spool/mail/oracle
[oracle@yyjk sbin]$ cat testdbi3.pl
use DBI;
no warnings;
use DBI;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
use Net::SMTP;
use Encode;
use JSON;
use Sys::SigAction qw( set_sig_handler );
my $dbip='10.2.120.192';
#my $dbip='10.2.120.192';
my $dbname='uacdb';
my $dbuser='xx';
my $dbpass='xxx';
eval {$dbh1 = DBI->connect( "dbi:Oracle://$dbip:1521/$dbname", $dbuser, $dbpass ) or die "Cannot conenct db: $DBI::errstr\n";};
if ($@){
print '-------------------'."\n";
print '11111111111111'."\n";
}
else{
print '222222222222222'."\n";
};
print %h2;