RE: determining who has locks on tables
Posted in 2000
The instructor for my Informix internals class provided the following
script.
You might give it a try.
#!/bin/ksh
# PROGRAM NAME: locks
# IFMX VERSION: Online 7.x
# DESCRIPTION : Checks for processes waiting for table lock
# and displays owner of lock.
# DATE INT DESCRIPTION
# ======== ===
===============================================================
# ??/??/92 mhl ORIGINAL CODE, V1.0.0.
# 01/28/93 mhl added display for lock owner
# ======== ===
===============================================================
#
onstat -k | egrep -v "INFORMIX|Informix|RSAM|Locks|address|active" | grep
[0-9a-z] | \\
nawk '{
if ($2 > '0')
{
printf ("\\n%-10s %-10s %-10s %-10s\\n",$1,$2,$3,$6)
if ($3 != "owner" && $3 != "100000" && $3 != "")
{
str = "onstat -u | grep \\"^" $3 "\\""
system(str)
}
}
}'
If you are being prevented from altering the structure of a table or
creating/dropping indexes, the culprit may not show up in "onstat -k".
You need to run "onstat -g opn" and determine who has the table "open".
Good luck,
Rick
-----Original Message-----
From: Brett Geer [mailto:brett@brabys.co.za]
Sent: Thursday, November 30, 2000 05:22
To: informix-list
Subject: determining who has locks on tables
Meet my problem, I know onstat -k shows who has locks on records,
but sometimes I don't see the locks shown (7.31.UC4 on AIX),
does anyone have scripts that show who has locks on what and
who is waiting for a lock on a record?
brett
--
-----------------------------------------------------------------
Brett's ninth law of UNIX administration...
Ye shall read the words:
http://cm.bell-labs.com/who/ken/index.html
http://cm.bell-labs.com/who/dmr/index.html
-----------------------------------------------------------------
Brett Geer - UNIX Admin/Analyst/Programmer - Intratex Holdings.
Tel. +27 31 717 4000 Direct. +27 31 717 4146
Fax. +27 31 717 4001
-----------------------------------------------------------------
If you have any trouble sounding condescending,
find a Unix user to show you how it's done.
--Scott Adams
-----------------------------------------------------------------