Deadlock [message #59684] |
Tue, 16 December 2003 02:37 |
Raj
Messages: 411 Registered: November 1998
|
Senior Member |
|
|
Is the following script ok for dedecting a deadlock and send mail to concerned person
If not please provide solution
###################################################################
## deadlock_alert.sh ##
###################################################################
sqlplus -s INFOTEST1/TEST1@$1 << end
set feed off
set heading off
spool deadlock.alert
SELECT SID, DECODE(BLOCK, 0, 'NO', 'YES' ) BLOCK,
REQUEST
FROM V_DEADLOCK
WHERE REQUEST > 0
ORDER BY block DESC;
spool off
exit
echo filesss
if [[ `cat deadlock.alert|wc -l` -gt 0 ]]
then
mailx -s "DEADLOCK ALERT for ${1}" xxx@sss.com < deadlock.alert
fi
exit 0
|
|
|
Re: Deadlock [message #59695 is a reply to message #59684] |
Tue, 16 December 2003 20:40 |
Frank Naude
Messages: 4587 Registered: April 1998
|
Senior Member |
|
|
Hi,
This script will not work - unless you've created a view called V_DEADLOCK (should it be v_$lock?), the SELECT statement will fail.
BTW: Why do you want to detect deadlocks? Oracle will automatically detect and resolve deadlocks. It is the blocking locks you should be concerned about!
Best regards.
Frank
|
|
|