#!/bin/sh # # This is a shell archive. To extract its contents, # execute this file with /bin/sh to create the file(s): # # topdb.sh # # This shell archive created: Tue May 7 10:54:09 EDT 2002 # echo "Extracting file topdb.sh" sed -e 's/^X//' <<\SHAR_EOF > topdb.sh X#!/usr/bin/ksh X X######################################################################################## X# X# topdb.sh: like top command in Unix X# Author: Vagner Pontes X# Company: Yoshitec Informatica Ltda - www.yoshitec.com.br X# X######################################################################################## X X XARQAUX=topdb.aux X Xif [ -r $ARQAUX ] X then X rm topdb.aux Xfi X Xecho "Wait ... (20 Interactions | onstat -g act)" X Xdate X XCONT=1 Xwhile true Xdo X X if [ $CONT -gt 20 ] X then X break X fi X X onstat -g act | tail +6 | grep sqlexec | awk ' { print substr($1,1,8),"|",$6,"|" } ' >> $ARQAUX X X CONT=` expr $CONT + 1 ` X X Xdone; X X Xecho "create temp table tmp_topdb (col1 char(10), col2 char(10)) with no log ; \ X load from $ARQAUX insert into tmp_topdb; \ X select trunc(count(*)) Exec,a.sid,a.username as user,a.pid,a.hostname as host \ X from tmp_topdb x, sysscblst a, sysrstcb b \ X where a.address = b.scb and a.addresspad = b.scbpad \ X and bitval(b.flags, '0x80000') = 1 \ X and b.tid = x.col1 \ X group by 2,3,4,5 having count(*)>1 order by 1 desc " | \ X dbaccess sysmaster 2> /dev/null X X Xdate SHAR_EOF if [ `wc -c < topdb.sh` -ne 1143 ] then echo "Lengths do not match -- Bad Copy of topdb.sh" fi echo "Done." exit 0