Monitor Locks
Posted in 2007
Topics: SQL Development & Query Writing
Version: IDS 10 For a given table how can I find out which process is holding lock. Basically I am trying to device a way that monitors frequent locks, type of lock held page level, row level etc, and the process/session that's holding that lock. I have following query that gives information about the db and user but I am looking for something in addition that could help me determine: 1. Table that has the lock 2. If the lock is row level, page level 3. If it's exclusive, shared etc. 4. If that lock is being held over certain period of time. Is this query correct: select sysdatabases.name database, -- Database Name syssessions.username, -- User Name syssessions.hostname, -- Workstation syslocks.owner sid -- Informix Session ID syslocks.tabname from syslocks, sysdatabases , outer syssessions where syslocks.tabname = "sysdatabases" -- Find locks on sysdatabases and syslocks.rowidlk = sysdatabases.rowid -- Join rowid to database and syslocks.owner = syssessions.sid -- Session ID to get user info order by 1;
On Nov 8, 5:28 pm, mohitanch...@gmail.com wrote: > Version: IDS 10 > > For a given table how can I find out which process is holding lock. > Basically I am trying to device a way that monitors frequent locks, > type of lock held page level, row level etc, and the process/session > that's holding that lock. I have following query that gives > information about the db and user but I am looking for something in > addition that could help me determine: > 1. Table that has the lock > 2. If the lock is row level, page level > 3. If it's exclusive, shared etc. > 4. If that lock is being held over certain period of time. > > Is this query correct: > > select sysdatabases.name database, -- Database Name > syssessions.username, -- User Name > syssessions.hostname, -- Workstation > syslocks.owner sid -- Informix Session ID > syslocks.tabname > from syslocks, sysdatabases , outer syssessions > where syslocks.tabname = "sysdatabases" -- Find locks on > sysdatabases > and syslocks.rowidlk = sysdatabases.rowid -- Join rowid to > database > and syslocks.owner = syssessions.sid -- Session ID to get > user info > order by 1; Please search the CDI archive at the IIUG web site. This one's asked almost weekly and is probably even in the FAQ. Art S. Kagel