Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Manually Unlocking records in IDS

183 views
Skip to first unread message

JoeT

unread,
Jun 30, 2005, 11:20:31 AM6/30/05
to
Hi...

I have a PHP application under development and have an annoying
problem.

I am purposely trying to kill the code (testing) and sometimes when I
trap an error, I'm getting codes bad of 244 and 107, saying that a
record is locked. I can't do anything in dbaccess either.

What's the proper way to kill the locked record without restarting the
server?

Thanks,
Joe

Bill Dare

unread,
Jun 30, 2005, 2:49:53 PM6/30/05
to

I identify the session that is holding the locks in question and do an
"onmode -z" on that session.

To identify the session:

1) run dbaccess and set lock mode to wait indefinately
2) from that dbaccess session do a select on the data which is locked,
dbacces should hang waiting for the lock
3) from another dbaccess session execute the following against the
sysmaster database:
select dbsname,
b.tabname,
rowidr,
keynum,
e.txt type,
d.sid owner,
hex(d.address) ownrstcb,
g.username ownname,
j.pid ownpid,
f.sid waiter,
hex(f.address) waitrstcb,
h.username waitname,
i.pid waitpid
from syslcktab a,
systabnames b,
systxptab c,
sysrstcb d,
sysscblst g,
flags_text e,
sysrstcb f , sysscblst h, syssessions i, syssessions j
where a.partnum = b.partnum
and a.owner = c.address
and c.owner = d.address
and a.wtlist = f.address
and d.sid = g.sid
and e.tabname = 'syslcktab'
and e.flags = a.type
and f.sid = h.sid
and h.sid = i.sid
and d.sid = j.sid
into temp A;

select
tabname[1,18],
type[1,4],
owner,
ownname[1,8],
waiter,
waitname[1,8]
from A;

This will return something like the following:

Database selected.


1 row(s) retrieved into temp table.

tabname type owner ownname waiter waitname

trig_fodrstat_03 X 2497368 jcatadm 2497416 jcatadm

1 row(s) retrieved.


Database closed.


Your dbaccess session waiting for the lock will be the "waiter". The
"owner" is the session holding the lock you want to remove. onmode -z
that session. In the output above that would be:

onmode -z 2497368

HTH,
Bill

sending to informix-list

Art S. Kagel

unread,
Jul 5, 2005, 12:02:54 PM7/5/05
to JoeT
JoeT wrote:
> Hi...
>
> I have a PHP application under development and have an annoying
> problem.
>
> I am purposely trying to kill the code (testing) and sometimes when I
> trap an error, I'm getting codes bad of 244 and 107, saying that a
> record is locked. I can't do anything in dbaccess either.

Once the session has completely died the locks will be released. IDS never
retains locks owned by defunct sessions. Sometimes a session survives its
client which may be what you are experiencing. There are usually one of two
causes:

1- The session is rolling back a larger transaction that the client began.
2- The server has not yet recognized that the client is defunct (this mostly
happens with Windows clients, but I've seen it with UNIX clients occassionally).

For the first case there's nothing you can do until the transaction rollback
completes (onstat -u will show the sessions and the flags will include an
'R' for rollback for the session that was killed). Just monitor the
rollback, the nwrites columns in onstat -u will double from its value at the
moment you killed the client when the rollback is just about complete. This
is bacause the same number of pages written in the transaction now have to
be rewritten with their original values during the rollback.

In the second case once you've identified the session id in onstat -g ses
you can kill the session with onmode -z <sessid>.

Art S. Kagel

Jean

unread,
Aug 2, 2005, 9:44:29 AM8/2/05
to
... unless it's a global XA transaction
"Art S. Kagel" <ka...@bloomberg.net> a écrit dans le message de
news:42CAAF2E...@bloomberg.net...
0 new messages