Learning Horizon | For Learners

ASP.NET, SQL SERVER, JQUERY,JAVASCRIPT, WEBSPHERE

Monday 3 August 2020

How To Check Lock Waits On IBM DB2 Database

Few days ago we received a complaint of slowness on one of our application so I have to check lock waits on IBM DB2. In this tutorial we will learn how to check lock waits on IBM DB2.

What are Lock Waits ?

Lock waits happen when a transaction or query wants to obtain a lock on resources such as database tables but that lock is already held by another query or transaction and if duration of these lock waits increase you will experience slowness in execution of query or transaction.

How to check Lock Waits ?

1. Login to your IBM DB2 database using database admin/owner login.

2. Type following command.

    db2top -d <database_name>

In my case the command was db2top -d P1DED where P1DEDB is the name of DB2 database.


db2-top-command

3. Type capital U by pressing shift key + u and you will see below screen.

check-lock-wait-screen

 

4. Type capital L by pressing shift key + l and you will see below screen. If there are some lock waits you will see them in next screen (as shown below in second screen shot.) and if there is nothing it means there are no lock waits(as shown in first screen shot) on your database and it is normal.

no-lock-waits

lock-waits

Hope this post will helpful for you. Please comment in the comment section below and share the post if you find this post informative and helpful. Thanks.

2 comments:

Please do not enter spam links.