Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    The Netherlands

    Unanswered: 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...


  2. #2
    Join Date
    May 2004
    New York
    Displays locks, users and tables using the base tables
    used to create the view syslocks. -----------------------------------------------------------------------------

    database sysmaster;

    select dbsname,
    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,
    -- keynum,
    -- waiter,
    -- waitname

  3. #3
    Join Date
    Aug 2006
    The Netherlands
    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
    Last edited by Tyveleyn; 01-26-07 at 05:08.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts