check table exclusive
Posted in 1999
Topics: Triggers, Constraints & Referential Integrity
Hi Friends ,
I face a problem that I tried to create a trigger on a table ,
but system said the table is in exclusive , so I want to know
how can I check from onstat to find out which tables is in the
exclusive mode , furthermore , I want to know how to find which
table is read or write by someone , and which kind of sql is
operating on the table I specified .
Thanks in advance
JianJun
Sent via Deja.com http://www.deja.com/
Before you buy.
jjdai@hotmail.com wrote:
>
> Hi Friends ,
>
> I face a problem that I tried to create a trigger on a table ,
> but system said the table is in exclusive , so I want to know
> how can I check from onstat to find out which tables is in the
> exclusive mode , furthermore , I want to know how to find which
onstat -k will show you locks. Look for the partnum, in hex, of the tableor any of it's fragments (select hex(partnum) from systables and/or
sysfragments) to see whether anyone has a lock on that table.
> table is read or write by someone , and which kind of sql is
> operating on the table I specified .
onstat -g opn will show you, by thread id, what tables are currently beingaccessed. Tracking tid to sid (session id) is non-trivial and requires several
steps using onstat, you may do better querying the SMI tables.
Art S. Kagel
This SQL give you the pid of the process that lock the table
SELECT tabname, rowidlk, type, username, sid, pid
FROM sysmaster:syslocks a,
sysmaster:syssessions b
WHERE a.owner = b.sid
AND dbsname = "<database name>"
AND tabname = "<table name>"
Art S. Kagel <kagel@bloomberg.net> wrote in message
news:38073EC0.257637BA@bloomberg.net...
> jjdai@hotmail.com wrote:
> >
> > Hi Friends ,
> >
> > I face a problem that I tried to create a trigger on a table ,
> > but system said the table is in exclusive , so I want to know
> > how can I check from onstat to find out which tables is in the
> > exclusive mode , furthermore , I want to know how to find which
>
> onstat -k will show you locks. Look for the partnum, in hex, of the table> or any of it's fragments (select hex(partnum) from systables and/or
> sysfragments) to see whether anyone has a lock on that table.
>
> > table is read or write by someone , and which kind of sql is
> > operating on the table I specified .
>
> onstat -g opn will show you, by thread id, what tables are currently being> accessed. Tracking tid to sid (session id) is non-trivial and requires
several
> steps using onstat, you may do better querying the SMI tables.
>
> Art S. Kagel
Related threads
- record locked
- who locks a record?
- Regarding Non-Default Page Sizes
- Don't Understand Table's Space Requirement