If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Check exclusive table access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-07, 09:38
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Check exclusive table access

Hi all,

I'm trying to find a way to check the current usage of a table because my script needs exclusive access to perform a SET TRIGGERS statement. In the script I've called 'onstat -g sql sessions' (from which's output I grep for the tablename) but that returns only the last parsed statements by the active sessions. It frequently goes wrong and I guess that's because the table is accessed by an open cursor in the 4GL application.
Does anyone have any clue to check for these kind of conditions?

I'll be much obliged with a definite solution...

Regards
Reply With Quote
  #2 (permalink)  
Old 01-25-07, 15:37
artemka artemka is offline
Registered User
 
Join Date: May 2004
Location: New York
Posts: 248
Displays locks, users and tables using the base tables
used to create the view syslocks. -----------------------------------------------------------------------------

database sysmaster;

select dbsname,
b.tabname,
rowidr,
keynum,
e.txt type,
d.sid owner,
g.username ownername,
f.sid waiter,
h.username waitname
from syslcktab a,
systabnames b,
systxptab c,
sysrstcb d,
sysscblst g,
flags_text e,
outer ( sysrstcb f , sysscblst h )
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
into temp A;

-- Some fields are commented out to fit on an 80 column display
select dbsname,
tabname,
rowidr,
-- keynum,
type[1,4],
owner,
ownername
-- waiter,
-- waitname
Reply With Quote
  #3 (permalink)  
Old 01-26-07, 04:13
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Thanks artemka!!!

This gives me some very useful clues. I still have to figure out where to get the tabname of the specific production databases table that's being locked but I guess it's possible starting from here. Can you tell me where to get the information about the views used in your query? I'm not realy familiar with the sysmaster database and I don't get any results when I search for the view names in my document set.
BTW, I abandoned the use of a script and coded the thing in an application language. By this I can disable the trigger, update some records and enable the trigger again in one transaction so it's not necesary anymore to check the exclusive tableaccess in front. It still would be nice though to inform the user who performs this function about the users who are locking the table.

Again, thanks a lot
Hans

Last edited by Tyveleyn; 01-26-07 at 05:08.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On