DBD 超時和報錯
阿新 • • 發佈:2019-01-03
[[email protected] 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
[[email protected] 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
[ [email protected] 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='uac';
my $dbpass='uac_123';
eval {$dbh1 = DBI->connect( "dbi:Oracle://$dbip:1521/$dbname", $dbuser, $dbpass ) or die "Cannot conenct db: $DBI::errstr\n";};
if ( [email protected]){
print '-------------------'."\n";
print '11111111111111'."\n";
}
else{
print '222222222222222'."\n";
};
print %h2;