This is an excerpt from the bestselling book
Oracle Grid & Real Application Clusters. To get immediate
access to the code depot of working RAC scripts, buy it
directly from the publisher and save more than 30%.
The main function of the global
cache service (GCS) is to track the status and location of the data
blocks. Status is the resource role and the resource mode. The GCS
is the main mechanism by which cache coherency among the multiple
caches is maintained.
GCS maintains the modes for
blocks in the global role and is responsible for block transfers
between the instances. The LMS processes handle the GCS messages and
carry out the bulk of the GCS processing. GCS resource coordination
is explained in detail in later sections.
Global Enqueue Service (GES)
The global enqueue service (GES)
tracks the status of all Oracle enqueuing mechanisms. This involves
all non-cache fusion intra-instance operations. The GES performs
concurrency control on dictionary cache locks, library cache locks,
and transactions. It performs this operation for resources that are
accessed by more than one instance.
What exactly is an enqueue?
Enqueues are shared memory structures that serialize access to the
database resources. For example, when a user updates a row and gets
a row-level lock, a TX enqueue is created for that user. If another
user subsequently attempts to update that same row, that user's
session will block (wait on) the enqueue that the initial user
created. They are sometimes referred to as positive waits.
Enqueues are local to one
instance, if real application clusters are not enabled. When the
real application cluster is enabled, the enqueues can be global to
the database. Enqueues are comprised of transaction locks, DML
locks, SCN locks, etc.
Enqueues are associated with a
session or a transaction. They are held longer than the latches,
have finer granularity, more modes than the latches, and protect
more database resources. For example, when a table lock is
requested, the request is assigned to an enqueue. Oracle can use
enqueues in any of three modes: null (N) mode, shared (S) mode, or
exclusive (X) mode.
The GES controls access to data
files and control files but not for the data blocks. GES processing
includes the coordination for enqueues other than the data blocks.
The resources managed by the GES
include the following:
? It is acquired in the exclusive mode when a transaction initiates
its first row level change. The lock is held until the transaction
is committed or rolled back.
Library Cache locks
- When a database object (such as a table, view, procedure,
function, package, package body, trigger, index, cluster, or
synonym) is referenced during parsing or compiling of a SQL, DML or
DDL, PL/SQL, or Java statement, the process parsing or compiling the
statement acquires the library cache lock in the correct mode.
Dictionary Cache Locks
- Global enqueues are used in the cluster database mode. The data
dictionary structure is the same for all Oracle instances in a
cluster database, as it is for instances in a single-instance
database. However, in real application clusters, Oracle synchronizes
all the dictionary caches throughout the cluster. Real application
clusters use latches to do this, just as in the case of a
single-instance Oracle database.
? These are the GES locks that protect the entire table(s). A
transaction acquires a table lock when a table is modified. A table
lock can be held in any of several modes: null (N), row share (RS),
row exclusive (RX), share lock (S), share row exclusive (SRX), or