Re: Monitor sessions
Posted in 2008
Topics: Logging & Checkpoints, Third-Party Tools & Monitoring
On Jan 16, 11:22 am, mohitanch...@gmail.com wrote:
> On Jan 16, 10:10 am, mohitanch...@gmail.com wrote:
>
>
>
> > On Jan 16, 5:29 am, scottishpoet <drybur...@yahoo.com> wrote:
>
> > > On Jan 16, 12:43 am, mohitanch...@gmail.com wrote:
>
> > > > Version: IDS 10
>
> > > > I am trying to write a script that will find out those threads or
> > > > sessions that are stuck at particular step for more than x mts. It
> > > > could be stuck to acquire a lock on a resouce, or waiting for buffer
> > > > or checkpoint or using lot of logical logs or may be just running a
> > > > particular DB operation like long updates, inserts etc. I was thinking
> > > > of using output from onstat -u and parse first flag 1 and run again
> > > > after x mts and compare and spit out the details to the user. However,
> > > > I am not really sure if it covers all the scenarios. What's the better
> > > > way of writing such a script ?
>
> > > Is upgrading to IDS 11 a possibility?
>
> > > The OpenAdmin Tool provided with IDS 11 probably provides a lot of the
> > > information you are looking to capture.
>
> > Not at this point.- Hide quoted text -
>
> > - Show quoted text -
>
> To start with, I wrote this small script that will report those
> processes that are writing most logical logs, this script is an
> attempt to identify processes that could potentially lead to long
> transactions and also report high usage of logical logs, please
> review:
>
> #Get that process that's writing most logical logs
> onstat -g tpf | tr -s " " | sort -nr -k 16 | head > onstat.tpf.out
> for i in `cat onstat.tpf.out|cut -d " " -f1`> do
> if [ $i -gt 0 ]
> then
> echo "------ LOGICAL LOG $i START"
> user_add=`onstat -g ath|grep $i|tr -s " "|cut -d " " -f4`
> if [ `echo "$user_add"|grep -c "[a-z]` -gt 0 ]
> then
> sess_id=`onstat -u |grep $user_add|cut -d " " -f3`
> if [ `echo "$sess_id"|grep -c "[0-9]"` -gt 0 ]
> then
> u_pid=`onstat -g ses|grep "^$sess_id"|tr -s " "|cut -d "
> " -f4`
> echo "Process Info "
> ps -eaf|grep "$u_pid"
> fi
> fi
> echo "------ LOGICAL LOG $i END"
> fi
> done
Anybody like to comment on this script, if it's ok, bad or whatever ?
>> onstat -g tpf | tr -s " " | sort -nr -k 16 | head > onstat.tpf.out
>> for i in `cat onstat.tpf.out|cut -d " " -f1`>> do
>> if [ $i -gt 0 ]
>> then
>> echo "------ LOGICAL LOG $i START"
>> user_add=`onstat -g ath|grep $i|tr -s " "|cut -d " " -f4`
>> if [ `echo "$user_add"|grep -c "[a-z]` -gt 0 ]
>> then
>> sess_id=`onstat -u |grep $user_add|cut -d " " -f3`
>> if [ `echo "$sess_id"|grep -c "[0-9]"` -gt 0 ]
>> then
>> u_pid=`onstat -g ses|grep "^$sess_id"|tr -s " "|cut -d "
>> " -f4`
>> echo "Process Info "
>> ps -eaf|grep "$u_pid"
>> fi
>> fi
>> echo "------ LOGICAL LOG $i END"
>> fi
>> done
>
> Anybody like to comment on this script, if it's ok, bad or whatever ?
It's bad. There are no comments!