From:	SMTP%"cnote@helpmt.sio.com" 26-OCT-1994 11:16:45.66
To:	EVERHART
CC:	
Subj:	Re: How do I find out which process has an RMS record locked?

From: cnote@helpmt.sio.com
X-Newsgroups: comp.os.vms
Subject: Re: How do I find out which process has an RMS record locked?
Date: 25 Oct 1994 16:55:13 GMT
Organization: SiO Technologies Inc., Woodland Park, CO, 80863
Lines: 58
Message-ID: <38jd9h$24q@potogold.rmii.com>
Reply-To: cnote@helpmt.sio.com
NNTP-Posting-Host: helpmt.sio.com
To: Info-VAX@Mvb.Saic.Com
X-Gateway-Source-Info: USENET

In article <JI91q9p.mwripley@delphi.com>, mwripley@delphi.com writes:
>Every now and then it is necessary to find out which process has a particular
>record locked.  It's easy enough to find out which processes are using a file
>(show dev /files,etc) but it would be extremely helpful to know which process
>is holding a lock on a record that another (presumably more vital) process
>needs.  Any suggestions?
> 

Sure... You need privs, then do:

$ ANALYZE/SYSTEM
SDA> SHOW SUMMARY       [/IMAGE]	! identify a "waiting" process
SDA> SET PROCESS/INDEX=#		! get # from SHOW SUMMARY output
SDA> SHOW PROCESS/LOCK

If you're waiting on any locks you'll see a screenfull display of lock
information, part of which will be "waiting for" or "converting to" as
opposed to "granted at" (which means you've got it).  If at the bottom
you see something like "process copy of lock <some-number> on node <csid>"
then you have to get logged into the other node.  Do an SDA> SHOW CLUSTER
to map the csid to the nodename.

The important part to take from the display is the lock-id, whether you
got it from the <some-number> value or the lock-id if you don't see the
"process copy ..." message.  You take that value and on the appropriate
node do:

SDA> SHOW RESOURCE/LOCK=lock-id

You should find a "granted queue" if all goes according to plan.  In that
granted queue will most likely be the lock-id's of the locks that are causing
your chosen hung process to hang.  Pick a lock-id from the granted queue
and:

SDA> SHOW LOCK lock-id

If, at the bottom you see "master copy of <some-number> on node <csid>"
repeat the above commands to find out what node it is, get logged in 
over there and from SDA issue a SHOW LOCK lock-id where lock-id again is
the appropriate value either from SHOW RESOURCE or the "master copy ..."
message.

Once you've tracked down the blocking lock you can try to take the PID
from the SHOW LOCK output and figure out what the blocking process is
waiting for.  If its another lock (hint: SHOW PROCESS/LOCK) then you
get to repeat the entire process over again.

Good luck -
J

--
CNOTE SOFTWARE		28 new lexicals w/SOURCE CODE, online help, users
1.800.797.6647          manual and the ability to write your own for $99.
			Surf over to http://sio.com/cnote/ for a free 30
			day trial.  *FREE* software just for stopping in.
			No web browser ? No Problem ! You can FTP to us
			at "CNOTEFTP@mhelp.sio.com".  Questions ? Please 
			email them to us at cnote@helpmt.sio.com ...
