sqlplus timeout [message #265081] |
Wed, 05 September 2007 06:35 |
coolbalaga
Messages: 24 Registered: September 2006
|
Junior Member |
|
|
Hello,
Need your help.
Is there something like a timeout tunable parameter that can be set for the sqlplus operation ?
like if suppose I am executing the sqlplus "select * from .." operation and if it taking a more time than the timeout period, then it should abort instead of the hang.
Thanks in advance.
|
|
|
|
|
|
|
|
|
Re: sqlplus timeout [message #266320 is a reply to message #265081] |
Mon, 10 September 2007 09:05 |
KCee
Messages: 16 Registered: October 2006
|
Junior Member |
|
|
You can use other software like 'perl'.
In perl you can use function 'alarm()' to kill a command within a defined time. Works nice.
|
|
|
|
Re: sqlplus timeout [message #266324 is a reply to message #265081] |
Mon, 10 September 2007 09:35 |
KCee
Messages: 16 Registered: October 2006
|
Junior Member |
|
|
my ( $l_cmd, $l_line, $l_timeout );
$l_cmd = "sqlplus /nolog \@pwd2.sql 2>&1";
$l_timeout = 5;
my $pid = 0;
eval
{
local $SIG{ALRM} = sub
{
printf "\n%%'sqlplus' Action took more than '$l_timeout' seconds !\n";
printf "($l_cmd); pid=$pid\n\n";
kill( 15, $pid ) if $pid > 1;
exit 1;
};
alarm( $l_timeout );
$pid = open( PH, "$l_cmd |" ) || printf( "Could not execute '$l_cmd': $!\n" );
while ( my $line = <PH> )
{
push @output, $line;
}
alarm( 0 );
};
print "pid = $pid\n\n";
eval { alarm(0) }; # The alarm reset must be outside the eval{}.
}
[Updated on: Mon, 10 September 2007 10:47] by Moderator Report message to a moderator
|
|
|
Re: sqlplus timeout [message #266338 is a reply to message #266324] |
Mon, 10 September 2007 10:45 |
|
Michel Cadot
Messages: 68729 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
You don't interrupt the operation, you kill the program. And you no more have an interactive session, just batch.
Maybe it is sufficient for OP.
In addition,
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Regards
Michel
[Updated on: Mon, 10 September 2007 10:48] Report message to a moderator
|
|
|