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%.
Before beginning a detailed
evaluation of the features of failover database clusters and high
performance parallel database clusters, how the database maintains
consistent data in a multi-user environment will be highlighted.
While dealing with the setup of
a database in a clustered environment, guaranteed data integrity and
provision of consistent data results are most crucial.
Relational Database systems
allow concurrent access to the database content such as rows and
tables. The same data is retrieved and updated by many users. This
concurrent access requires a meaningful control of access and should
provide consistent results. There are two major concepts for
database access. They are Data concurrency and Data Consistency.
Data concurrency allows unhindered access by any number of users to
the same data at the same time. Data consistency means that each
user sees a consistent view of data, including visible changes made
by the user’s own transactions and transactions of other users. To
provide consistent transaction behavior, database systems follow
appropriate transaction isolation models. For example, Oracle
automatically provides read consistency to queries so that all the
data a query sees comes from a single point in time, also called
statement level read consistency. It can also provide
transaction-level read consistency as an option. Oracle makes use of
rollback segments to provide these consistent views. The local cache
of the instance has all the relevant data blocks to satisfy
consistent results for database operations. Figure 3.6 shows the
simultaneous access of data blocks by many users through same and
different instances.
Figure 3.6: Data
Concurrency and Data Consistency
In a failover database cluster
environment, all nodes actively access the disk storage unit that
provides data volumes or file systems. The active node is where the
database instance is running. The database instance, with memory
structures and processes, is nothing but a front end for physical
data blocks or data pages. The database instance’s local cache
on the active node is the place where blocks are fetched into,
modified and flushed back to physical storage unit. The local cache
is where active buffers are handled for processing by SQL
statements. Since this process deals with a single instance
and only one set of cache buffers, the consistency mechanism is
confined to this local cache.
However, in a parallel database
clustered environment where there are multiple instances located on
multiple nodes, data consistency mechanisms go beyond one instance
and cover the database caches of all the nodes. Multiple caches are
joined virtually to provide a single cache image and used to process
SQL operations. When a user modifies a set of data blocks on one
node, another user accessing the same set of blocks on a second node
still gets read consistent blocks. The caches from both these nodes
act as if they are one single entity. For instance, Oracle Real
Application Cluster uses cache-to-cache block transfer, known as
Cache Fusion, to move read-consistent images of data blocks from one
instance cache to another instance cache. To support such an
activity, there has to be some form of data locking.
Cache Fusion and locking
mechanism will be explored in more detail in Chapter 7, Cache Fusion
and Inter-Instance Coordination.