O'Reilly logo

Oracle Essentials: Oracle9i, Oracle8i and Oracle8, Second Edition by Jonathan Stern, Robert Stackowiak, Rick Greenwald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How Oracle Handles Locking

If you’ve read this chapter from the beginning, you should now know enough about the concepts of concurrency and the features of Oracle to understand how the database handles issues related to multiuser access. However, to make it perfectly clear how these features interact, we’ll walk you through three scenarios: a simple write to the database, a situation in which two users attempt to write to the same row in the same table, and a read that takes place in the midst of conflicting updates.

For the purposes of these examples, we’ll use the scenario of one or two users modifying the EMP table, a part of the standard sample Oracle schema that lists data about employees via a form.

A Simple Write Operation

This example describes a simple write operation, in which one user is writing to a row in the database. In this example, an HR clerk wants to update the name for an employee. Assume that the HR clerk already has the employee record on-screen. The steps from this point are as follows:

  1. The client modifies the employee name on the screen. The client process sends a SQL UPDATE statement over the network to the server process.

  2. The server process obtains a System Change Number (SCN) and reads the data block containing the target row.

  3. The server records row lock information in the data block.

  4. The server process copies the old image of the employee data about to be changed to a rollback segment and then modifies the employee data.

  5. The server process records the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required