Oracle Parallel Server uses different types of locks to control access to database resources by an instance. The following sections briefly describe the lock types used in a parallel server environment and contrast them with the types used in a standalone database.
An Oracle database (whether standalone or parallel server) allows multiple transactions to access the same data concurrently. Without proper control, this access would result in improper modifications and might destroy data consistency. Oracle maintains data concurrency and consistency using locks. Some locks prevent destructive interaction between simultaneous transactions that are accessing the same data. These locks are called transaction locks. Transaction locks are row-level locks, and they protect rows of data from being concurrently modified by more than one transaction. Row-level locking works identically in standalone Oracle (single-instance) and Oracle Parallel Server (multiple-instance) configurations.
Parallel server environments have an additional need for locks to maintain cache coherency. However, the locks used to maintain cache coherency are entirely different from transaction locks and are known as instance locks. Because instance locks are managed globally across all instances, some people refer to them as global locks. As discussed in Chapter 6, instance locks and inter-instance locking activities are coordinated by the Integrated Distributed Lock Manager (IDLM). Table 8.1 compares instance locks with transaction locks.
Table 8-1. Comparison of Instance Locks and Transaction Locks
Instance Locks |
Transaction Locks |
---|---|
Specific to parallel server |
Used in standalone as well as parallel server databases |
Block-level locking |
Row-level locking |
Managed across multiple instances |
Managed between multiple transactions |
Maintain cache coherency |
Maintain data concurrency and consistency |
Protect data blocks, dictionary caches, etc., from modifications by more than one instance |
Protect rows of data from concurrent modifications by more than one transaction |
May be acquired and released many times during a transaction |
Exist for the life of a transaction |
Instance locks operate at the database block level and are used only when OPS is enabled. Row-level locking, achieved using transaction locks, is used regardless of whether OPS is enabled or disabled. Transaction locks and instance locks represent two different locking mechanisms that work independently of each other.
There are two types of instance locks: Parallel Cache Management (PCM) and non-Parallel Cache Management (non-PCM). PCM locks protect data blocks in an instance’s buffer cache. Non-PCM locks protect the System Change Number (SCN), library cache, dictionary cache, and so on. These two types of locks are discussed in detail later in this chapter.
Latches protect the data structures in the SGA of each instance. Latches are local to each instance and do not require inter-instance synchronization. Latches are handled identically in standalone Oracle (single-instance) and Oracle Parallel Server (multiple-instance) configurations.
All locks, other than PCM locks, are grouped together as enqueues. Enqueues may be local or global. When OPS is disabled, all enqueues are local. Local enqueues comprise transaction locks, DML locks (table locks), SCN locks, and other types of locks. However, when parallel server is enabled, most of these become global and are managed across all instances. Most of these global enqueues are non-PCM locks.
18.222.164.141