Thursday, May 4, 2017

Oracle: How to reactive-ly monitoring db_link timeout.

I thought this is an interesting question that brought up to me on how to reactive-ly responding to when there are packet loss and impacting the main server where application unable to retrieve data through synonym that pointing to db link. Since db link isn't a process and packet loss is outside of the database control and the server hosting the database instance, there isn't really anything can be done about it within the database. There isn't anything to be restarted or retried or anything built in inside Oracle OEM to monitor and reactive-ly responding to packet loss. 


Perhaps install simple script to check remote db_link is alive in the crontab.


#!/bin/ksh
chk_table=`sqlplus -s vc50/password1@orcl<<oem
set heading off;
select count(1) from dual@db_link_name;
oem
`
if [ $chk_table != "1" ]
then
echo $chk_table
echo -e 'Remote server might be down '`uname -n`'' | mail -v -s 'Package loss is happening' admin@company.com
fi



Another option would probably increase the sqlnet.inbound_connect_timeout parameter within sqlnet.ora but that is not exactly a way to monitor. Any other ways of reactive-ly monitoring db link dis-connectivity ?  If you do, please leave me a note. Thanks in advances.