https://stackoverflow.com/questions/20284424/db2-locked-table-how-to-find-pid-of-blocking-processs
I have little knowledge of db2 administration, and I can't figure out how to find the pid of the process locking the tab tables.
With db2top (screen "U"), I have the following table:
Agent Application Application Object Lock Object Lock Lock Is Locked Tablespace Id(State) Name Status Name Mode Type Status Count Blocker By Name ------------ ------------ -------------- ------------------- -------- ---------- ---------- ----- ------- -------- ----------- 7060(l) xxxxxxxxxx Lock Waiting YYYY01.TABLEZZ IS Table Granted 1 No 7974 USERSPACE1 7060(l) xxxxxxxxxx Lock Waiting Internal Variation S Variation Granted 1 No 7974 - 7060(l) xxxxxxxxxx Lock Waiting YYYY01.TABLEZZ[0] NS [X] Row - - No 7974 USERSPACE1 7060(l) xxxxxxxxxx Lock Waiting Internal Plan S Plan Granted 1 No 7974 - 7974(l) xxxxxxxxxx Lock Waiting Internal Variation S Variation Granted 1 Yes 8080 - 7974(l) xxxxxxxxxx Lock Waiting YYYY01.TABLEZZ[0] X [U] Row - - Yes 8080 USERSPACE1 7974(l) xxxxxxxxxx Lock Waiting Internal Plan S Plan Granted 1 Yes 8080 - 7974(l) xxxxxxxxxx Lock Waiting YYYY01.TABLEZZ IX Table Granted 1 Yes 8080 USERSPACE1
I have figured out that Agent 7974 is the blocking one. I'ld like to kill it and fix/test the bug. How can I figure out the pid of agent 7974 so I can attach a gdb to it?
If all you want to do is kill the agent, you can do it with db2 force application (7974)
. The client process ID is shown in db2top
on the session screen (press l
). You can also use db2pd -db <your database> -agents app=7974