Oracle’s multi-version consistency model
architecture distinguishes between a current data
block and one or more consistent read
(CR) versions of the same block. It is important to
understand the difference between the current block
and the CR block. The current block contains changes
for all the committed and yet-to-be-committed
transactions. A consistent read (CR) block
represents a consistent snapshot of the data from a
previous point in time. Applying undo/rollback
segment information produces consistent read
versions. Thus, a single data block can reside in
many buffer caches under shared resources with
different versions.
Multi-version data blocks help to achieve read
consistency. The read consistency model guarantees
that the data block seen by a statement is
consistent with respect to a single point in time
and does not change during the statement execution.
Readers of data do not wait for other writer's data
or for other readers of the same data. At the same
time, writers do not wait for other readers for the
same data. Only writers wait for other writers if
they attempt to write. As mentioned earlier, the
undo, i.e. rollback segment provides the required
information to construct the read-consistent data
blocks. In case of a multi-instance system, like the
RAC database, the requirement for the same data
block may arise from another instance. To support
this type of requirement, past images of the data
blocks are created within the buffer cache. Past
images will be covered later in the chapter.
Process Architecture
Oracle uses several processes to execute the
different parts of Oracle code and to spawn
additional processes for the users. Whenever a user
connects to the database, a new server process is
created on behalf of the user session. Functions of
the server process include the following:
-
Parse and execute SQL statements issued through
the application
-
Read the necessary data blocks from the disk
data files into the shared database buffers of
the SGA if the blocks are not already present in
the SGA
Interact and return results in such a way that the
application can process the information
There are many additional processes that are
automatically spawned whenever the instance starts.
These processes are called background processes, and
they perform the Oracle kernel functions.
Locking Mechanism
Locking is another important requirement of a
multi-version consistency model. Oracle also uses a
locking mechanism to control concurrent access to
the data blocks. Locks help prevent destructive
interaction between users accessing data blocks.
As seen earlier, when a user intends to update a
data block that has already been updated by another
user but is still in an uncommitted state, the
update event has to wait. Without a lock mechanism,
the data integrity would have been lost in this
case. Locks also ensure that the data being viewed
or updated by a user is not changed by other users
until the user is finished using the data.
In the case of a RAC system, new and improved
components or services namely, the Global Cache
Service
(GCS) and Global Enqueue Service
(GES) handle the lock and access management
functions better than the earlier Oracle Parallel
Server
distributed lock manager (DLM). GES is covered in
more detail later in this chapter.
|