查找被锁住的表
查找表在数据库中的内部表号
> select hex(partnum) from systables where tabname = 'tabname';
(expression)
0x00B0007D
1 row(s) retrieved.
>
查找上锁的用户线索
> [********~]$ onstat -k | grep B0007D -i
acf9bb918 0 1ee9ef8e8 ad0d7eed8 HDR+X b0007d 101 0
ad0d7eed8 0 1ee9ef8e8 ad1acf3a8 HDR+IX b0007d 0 0
查找用户线索对应的会话
[******** ~]$ onstat -u | grep 1ee9ef8e8
1ee9ef8e8 Y--P--- 639941 zhsq - 44d909c0 0 4 0 0
查看事务和锁的情况
[******** ~]$ onstat -x | grep 1ee9ef8e8
2c5440528 A---- 1ee9ef8e8 4 - - DIRTY - 0
找到对应的sql和session
[******** ~]$ onstat -g ses 639941
GBase 8s Database Server Version 12.10.FC4G1AEE -- On-Line -- Up 36 days 14:24:41 -- 48243292 Kbytes
Blocked:LAST_LOG_RESERVED4BACKUP
session effective #RSAM total used dynamic
id user user tty pid hostname threads memory memory explain
639941 zhsq - - 0 172.20.2 1 229376 195840 off
Program :
/root/TongWeb7.0/deployment/CAFP/WEB-INF/lib/ifxjdbc.jarcom.tongweb.catalina.startup/Bootstrap
tid name rstcb flags curstk status
642409 sqlexec 1ee9ef8e8 Y--P--- 8112 cond wait block -
Memory pools count 2
name class addr totalsize freesize #allocfrag #freefrag
639941 V 2d9f27040 225280 32728 308 29
639941*O0 V 152711040 4096 808 1 1
name free used name free used
overhead 0 6576 mtmisc 0 72
scb 0 144 opentable 0 15720
filetable 0 1648 log 0 16536
temprec 0 22688 keys 0 2032
ralloc 0 62160 gentcb 0 4408
ostcb 0 2944 sort 0 104
sqscb 0 37584 sql 0 72
hashfiletab 0 552 osenv 0 2248
sqtcb 0 13336 fragman 0 2152
sapi 0 64 udr 0 4800
sqscb info
scb sqscb optofc pdqpriority optcompind directives
2e61d2348 1526e7028 0 0 0 1
Sess SQL Current Iso Lock SQL ISAM F.E.
Id Stmt type Database Lvl Mode ERR ERR Vers Explain
639941 UPDATE zhsq DR Wait 30 0 0 9.28 Off
Current SQL statement (159) :
update portal_system_clusters set auto_products = null , wwwuris = null ,
denymodulesyscodes = ? , modulesyscodes = ? , name = ? , auto_wwwuris = ?
, products = null , l_accesstime = ? where l_key = ?
Host variables :
address type flags value
-----------------------------------------
0x000000015300b470 UDTVAR 0x000 <not shown>
0x000000015300b500 UDTVAR 0x000 <not shown>
0x000000015300b590 UDTVAR 0x000 <not shown>
0x000000015300b620 UDTVAR 0x000 <not shown>
0x000000015300b6b0 BIGINT 0x000 27727568
0x000000015300b740 UDTVAR 0x000 <not shown>
Last parsed SQL statement :
update portal_system_clusters set auto_products = null , wwwuris = null ,
denymodulesyscodes = ? , modulesyscodes = ? , name = ? , auto_wwwuris = ?
, products = null , l_accesstime = ? where l_key = ?
杀掉
[******* ~]$ onmode -z 639941