SQL805N on NULLID.SYS* package – Part 2
Earlier I had written about getting SQL805 on NULLID.SYS* package and how you can resolve it by adding more SYS* packages :
db2 “bind @db2cli.lst blocking all sqlerror continue grant public CLIPKG 12″
But how do you know that you are nearing the condition ?  Won’t an early warning system be good ?  Yes…it would be, so you can avoid an outage.  I wrote a simple script that  can alert you when it crosses a threshold. Here is it :
I called it count_cursors.sh :
dbas=”dba@techsatwork.com”
if [ -f /home/db2inst1/sqllib/db2profile ]; then
   . /home/db2inst1/sqllib/db2profile
fi
date >> /home/db2inst1/scripts/cursor_count.out
db2pd -db RAJUDB -static | grep SYSL | wc -l >> /home/db2inst1/scripts/cursor_count.out
count=`db2pd -db RAJUDB -static | grep SYSL | wc -l`
if [ $count -gt 900 ]
then
 mailoutput=`print “The statement handle count in RAJUDB is: “$count`
 echo $mailoutput > /home/db2inst1/scripts/mail.msg
 mailx -s “Important message from `uname -n`” $dbas < /home/db2inst1/scripts/mail.msg
 echo ‘The max cursor count for RAJUDB has exceed the threshold. Its now > ‘ $count
else
 echo ‘no issues….’ $count
 echo ‘No issues….so no mail’ > /home/db2inst1/scripts/mail.msg
fi
Use it and let me know if it actually helped you !