Databases Reference
In-Depth Information
There's more...
A deadlock is a situation where two or more transactions are waiting for data locked by each
other and none of these transactions can acquire the locks.
The database automatically detects the deadlocks and rolls back the statement causing it
in a transaction when a deadlock is detected. It is the user's responsibility to rollback the
remainder of the transaction.
Deadlocks are caused by excessive locking used by applications—which means that explicit
locking was requested, overriding the default database behavior—or by statements that
update data using different orders, as we have done in our example.
To avoid the latter cause of deadlocks, use shared code in your application to accomplish
the same task. This way you can be sure that operations will always be executed in the same
order, limiting the possibility of a deadlock.
See also
See Detecting and preventing lock contention in this chapter.
Tuning latches
In this recipe we will see what latches are, and how (and if) we can tune latches. We will discover
that we don't tune latches, but we tune resources that can cause issues related to latches.
How to do it...
The following steps will demonstrate how to tune latches:
1.
Connect to the database as SYSDBA :
CONNECT / AS SYSDBA
2.
Investigate system events related to latches:
SELECT
EVENT, TIME_WAITED, TOTAL_WAITS
FROM V$SYSTEM_EVENT
WHERE EVENT LIKE '%latch%';3
 
Search WWH ::




Custom Search