How to find out what caused the database(DB2) in a locking state I know how to check the DB is in a lock state or not, but my question is how to find out which query caused the lock on table /db. 

IS there any log file getting created if something unexpected happens to the database?
List the current database activities:

db2top -d [dbname]


This command will show you database locks:

db2pd -d [dbname] -lock wait