Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to handle ORA-12170: TNS:Connect timeout occurred

245858Apr 17 2008 — edited Apr 18 2008
Below code always worked well, even during times when listener down, etc., but now we have a new case -- the DB instance down, and even the host is down, not pingable. In this case, below code does not work -- we see a very long 'hang' / timeout (about 2-3min)! and then we just get error as below. Can anyone please advise a good way to handle this? I was not able to find any ideas here or on the net and in various references. I tried wrapping the OCILogon in a while(OCIError()) loop, but that did not seem to help.

Warning: ocilogon(): ociopen_server: ORA-12170: TNS:Connect timeout occurred


if (!($connect = OCILogOn($OraUserName,$OraUserPassword,$OraSID))) {
print "ERROR: Unable to connect to $OraSID";
$err=OCIError();
var_dump ($err);
die();
}

if (!($ORAstmt=OCIParse($connect,$query))) {
print "ERROR: Unable to parse SQL";
$err=OCIError($ORAstmt);
var_dump($err );
die();
}

OCIExecute($ORAstmt);

$rows = OCIfetchstatement($ORAstmt, $results);
< ... >
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2008
Added on Apr 17 2008
1 comment
4,305 views