Friday, June 17, 2011

Locks and Latches...mystery unfolds


Locks are mechanisms that prevent destructive interaction between transactions accessing the same resource. The resources can be either user objects, such as tables and rows, or system objects not visible to users, such as shared data structures in memory and data dictionary rows. Oracle Database automatically obtains and manages necessary locks when executing SQL statements, so you need not be concerned with such details. However, the database also lets you lock data manually.
A deadlock can occur when two or more users are waiting for data locked by each other. Deadlocks prevent some transactions from continuing to work. Oracle Database automatically detects deadlock situations and resolves them by rolling back one of the statements involved in the deadlock, thereby releasing one set of the conflicting row locks


Need for locks and latches
To access shared resources concurrently by other processes requiring access to the same resources.
To protect the contents of database objects while they are being modified or inspected by other processes
To serialize access to SGA data structures
Differences between locks and latches


Latches:
Provide only exclusive access to protected data structures
Request are not queued, if a request fails, process may try later


Locks:
Allow serialized access to some resources
Requests for locks are queued and serviced in order


EnjoyJ

1 comment:

Blogger said...

Did you know that that you can make cash by locking selected sections of your blog / site?
Simply join AdWorkMedia and use their Content Locking tool.