Tutorial: Diagnosing deadlocks

Use the tutorials in this section to learn how to use the Database Tracing Wizard to view deadlocks that might occur in your database. You can use the Database Tracing Wizard to examine the conditions under which the deadlocks are occurring, and the connections that are causing them.

Deadlocks occur when two or more transactions block one another. For example, Transaction A requires access to Table B, but Table B is locked by Transaction B. Transaction B requires access to Table A, but Table A is locked by Transaction A. A cyclical blocking conflict occurs.

A good indication that deadlocks are occurring is when SQLCODE -306 and -307 are returned. To resolve a deadlock, SQL Anywhere automatically rolls back the last statement that created the deadlock. Performance problems occur if statements are constantly rolled back.


Lesson 1: Creating the test database
Lesson 2: Creating a deadlock
Lesson 3: Capturing deadlock data
Lesson 4: Reviewing blocked connection data
Lesson 5: Viewing deadlock data