Is there a way to detect locked tables in MySQL? I mean tables locked by the LOCK TABLE table WRITE/READ
command.
(Note that readers interested in detecting named locks acquired with GET_LOCK
should read Show all current locks from get_lock instead.)
You can use the sys. dm_tran_locks view, which returns information about the currently active lock manager resources.
In MySQL, locked tables are identified using the SHOW OPEN TABLES command. In its simplest form is displays all locked tables. All open tables in the table cache are listed, but the IN_USE column indicates of the table is locked. When the first lock is taken, the value increments to 1.
Hold the tension wrench twisted in the correct direction and insert the rake into the lock where the teeth of the keys would go. Push and pull the rake out of the lock, twisting it and working by feel. Twist the tension wrench in the correct direction, and the lock should spring open!
Use SHOW OPEN TABLES
: http://dev.mysql.com/doc/refman/5.1/en/show-open-tables.html
You can do something like this
SHOW OPEN TABLES WHERE `Table` LIKE '%[TABLE_NAME]%' AND `Database` LIKE '[DBNAME]' AND In_use > 0;
to check any locked tables in a database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With