onstat -k and tblsnum?
Posted in 2000
Topics: Versions, Editions & End-of-Life
Folks,
Need some help. An application is experiencing locking problems, and 243
errors.
How can I find out which table belongs in tblsnum. Part of the output of
onstat -k reports on tblsnum, I want to determine which table in whichdatabase is in trouble. Querying syslocks revealed nothing, 0 rows
returned. onstat -k|grep X|wc -l returns > 600. Turns out there is a bug
(#114583) in all versions of IDS 7.3x.
HPUX-11.0
IDS 7.30FC7
Regards,
Scott Henderson
Yo Scott!
Here are a couple of scripts that could help give you some ideas. Both work
correctly under 7.3x (HP10.20 & Solaris 2.x)
#!/bin/ksh
# rudy Thu Mar 4 11:28:22 EST 1999
# locks.sh determines locking interactions - i.e which session is
# locked out by another.
TMP_FILE=$0.tmp.$$
GET_ONSTATK=1
FOUND=0
ABNORMAL="Abnormal termination. Cleaning up and exiting..."
trap "echo $ABNORMAL;rm -f $TMP_FILE ; exit 1" 1 2 13 15
for SESS in `onstat -u | grep "L-" | cut -b 18-26`
do
FOUND=1
echo "Session $SESS locked by session ... \\c"
for LOCK in `onstat -u | grep " $SESS " | cut -b 45-52`
do
if [ $GET_ONSTATK = 1 ]
then
onstat -k | cut -b 1-26 > $TMP_FILE
GET_ONSTATK=0
fi
LOCKER=`grep "^${LOCK} " $TMP_FILE | awk '{ print $3 }'`
LOCKER_SESS=`onstat -u | grep "${LOCKER} " | cut -b 18-26`
echo $LOCKER_SESS
donedone
if [ $FOUND = 0 ]
then
echo 'No process waiting on locks'
fi
rm -f $TMP_FILE
#!/bin/ksh
# Retrieve Locks Information
if [ $# -lt 1 ]
then
echo Usage $0 database [tablename]
exit 1
fi
DB=$1
TABLE=$2
if [ "$TABLE" = "" ]
then
dbaccess sysmaster << eo_db
set isolation to dirty read;
select username, sid, tabname, l.lk_type lock_type,
l.lk_kvobj rowid, lk_keynum key_num
from sysrstcb r, syslocktab l, systabnames t
where r.txp = l.lk_owner
and t.partnum = l.lk_partnum
and dbsname = "$DB";eo_db
else
dbaccess sysmaster << eo_db1
set isolation to dirty read;
select username, sid, tabname, l.lk_type lock_type,
l.lk_kvobj rowid, lk_keynum key_num
from sysrstcb r, syslocktab l, systabnames t
where r.txp = l.lk_owner
and t.partnum = l.lk_partnum
and dbsname = "$DB"
and tabname matches "$TABLE";eo_db1
fi
Cheers
Rudy
"Henderson, Scott" wrote:
> Folks,
>
> Need some help. An application is experiencing locking problems, and 243
> errors.
>
> How can I find out which table belongs in tblsnum. Part of the output of
> onstat -k reports on tblsnum, I want to determine which table in which> database is in trouble. Querying syslocks revealed nothing, 0 rows
> returned. onstat -k|grep X|wc -l returns > 600. Turns out there is a bug
> (#114583) in all versions of IDS 7.3x.
>
> HPUX-11.0
> IDS 7.30FC7
>
> Regards,
> Scott Henderson
Related threads
- record locked
- who locks a record?
- Regarding Non-Default Page Sizes
- Don't Understand Table's Space Requirement