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.
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:
The client modifies the employee name on the screen. The client process sends a SQL UPDATE statement over the network to the server process.
The server process obtains a System Change Number (SCN) and reads the data block containing the target row.
The server records row lock information in the data block.
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.
The server process records the ...