Sundaramurthy Blog

January 31, 2010

Oracle RAC Architecture

Filed under: Oracle RAC Architecture — sundar5 @ 6:00 pm

Distributed lock manager (DLM)

Originally, OPS was created for version 6.2 of Oracle for the VAX/VMS clusters of  Digital Equipment Corporation (DEC), the DLM devopmed by DEC was simply too slow and also it was not scalling for database buffers. so oracle decided to developed it own DLM module later it was adopted by DEC.

It enabled users to avoid context switching, which a kernel-based DLM would have required.  Later oracle integrated DLM inside th oracle(8) kernal now it is called Integrated data distributied manager(IDLM).

The IDLM controled the node sysnchronous access to the database resources. There two types of resource managed by IDLM

  • parallel cache management (PCM) locks
  • non-PCM locks

PCM uses IDLM locks to coordinate access to resources required by the instances of OPS. Rollback segments, dictionary entries, and data blocks are some examples of database resources. The most often required database resources are data blocks.

PCM Lock and Row Lock Independence

PCM locks and row locks operate independently. An instance can disown a PCM lock without affecting row locks held in the set of blocks covered by the PCM lock

All PCM locks are Buffer Cache Management locks

Oracle Lock Names

  • Lock Name Format
  • PCM Lock Names
  • Non-PCM Lock Names

Lock Name Format

type ID1 ID2

Where:
type
A two-character type name for the lock type, as described in the V$LOCK table
ID1
The first lock identifier, used by the IDLM. The convention for this identifier differs from one lock type to another.
ID2
The second lock identifier, used by the IDLM. The convention for this identifier differs from one lock type to another.

select * from V$LOCK where type ='MR'
ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059EA481F0 000000059EA48210       2195 MR       3770          0          4          0      43177          2
000000059EA48288 000000059EA482A8       2195 MR       3771          0          4          0      43177          2
000000059EA48320 000000059EA48340       2195 MR       3772          0          4          0      43177          2
000000059EA483B8 000000059EA483D8       2195 MR       3773          0          4          0      43177          2
.....
.....

6098 rows selected.

SQL> SELECT COUNT(*) FROM DBA_DATA_FILES;

  COUNT(*)
----------
      5097

SQL> SELECT COUNT(*) FROM DBA_TEMP_FILES;

  COUNT(*)
----------
      1001

SQL> SELECT 1001+5097 FROM DUAL;

 1001+5097
----------
      6098

SQL> select * from V$LOCK where type ='CF';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E9634C8 000000059E9634E8       2190 CF          0          0          2          0     222213          2

SQL> select * from V$LOCK where type ='CF';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E9634C8 000000059E9634E8       2190 CF          0          0          2          0     222213          2

SQL> select * from V$LOCK where type ='IS';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E963690 000000059E9636B0       2133 IS          0          0          4          0       1772          0

SQL> select * from V$LOCK where type ='XR';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E963398 000000059E9633B8       2190 XR          4          0          1          0     222271          2
000000059E963430 000000059E963450       2180 XR          0          0          1          0     222271          2

SQL> select * from V$LOCK where type ='TT';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059EA48028 000000059EA48048       2133 TT       1056          4          6          0       1808          2
000000059EA48468 000000059EA48488       2119 TT         62         16          4          0         27          2

SQ
SQL> select * from V$LOCK where type ='PS';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E963560 000000059E963580       2119 PS          1          0          4          0       3152          2
000000059EA48B88 000000059EA48BA8       2103 PS          1         10          4          0       2270          2

SQL> select * from V$LOCK where type ='RS';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E9635F8 000000059E963618       2190 RS         25          1          2          0     222231          2

SQL> select * from V$LOCK where type ='TS';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059EA47DC8 000000059EA47DE8       2189 TS         62          1          3          0     222045          2
000000059EA48500 000000059EA48520       2119 TS         62          3          0          4          3          0

SQL> select * from V$LOCK where type ='DM';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E9637C0 000000059E9637E0       2195 DM          1          0          4          0     222096          2

SQL> select * from V$LOCK where type ='RT';

ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
000000059E963728 000000059E963748       2191 RT          1          0          6          0     222393          2
000000059E963858 000000059E963878       2191 RT          1          1          6          0     222135          2
000000059E963988 000000059E9639A8       2195 RT          1          2          6          0     222135          2

PCM Lock Names

type
Is always BL because PCM locks are buffer locks.
ID1
Is the block class.
ID2
For fixed locks, ID2 is the lock element (LE) index number obtained by hashing the block address (see the V$LOCK_ELEMENT fixed view). For releasable locks, ID2 is the database address of the block.

Resoruce

Locks

BL 1,100

S

BL 1,104

X

BL 1,108

SSSNNN

BL 5,200

N

BL 2,102

NNN

Resource BL 1, 108 is held by three instances with shared locks and three instances with null locks. At least 6 instances are running on this system

Code

Lock Name

BL

Buffer Cache Management

Global Resource Directory (GRD)

Global Resource Directory (GRD) to record information about resources and enqueues.
It was maintain by (GES) and (GCS).

It contains convert and write queues and GRD is distributed to across all the instances.

Global Resource Directory structure

1.Data Block Addresses (DBA)

2.Location of most current version of the data block

3 Modes of the data blocks

(N)Null
(S)Shared
(X)Exclusive

4.The roles of the data blocks

local
global

5.System Change Number (SCN)
6.Image of the Data Block

Past Image (PI)
Current Image (XI)

Lock Structure :

LOCK MODE MODE DESCRIPTION
NL0 Null local 0 Null Local and No past images
SL0 Shared local 0 Shared Local with no past image
XL0 Exclusive local 0 Exclusive Local with no past image
NG0 Null Global 0 Null Global – Instance owns current block image
SG0 Shared  Global 0 Global Shared Lock – Instance owns current image
XG0 Exclusive Global 0 Global Exclusive Lock – Instance own current image
NG1 Null global 1 Global Null – Instance owns the past image block
SG1 Shared Global 1 Shared Global – Instance owns past image
XG1 Exclusive Glbal 1 Global Exclusive Lock – Instance owns past image.

Latches:

Latches are simple, low level serialization mechanicsms to protect in-memory data structures in the SGA.  Latches do not protect datafiles. They are entirely automatic, are held for a very short time, and can only be held in exclusive mode. Being local to the node, internal locks and latches do not provide  internode synchronization.

Enqueues

Enqueues are shared memory structures which serialize access to resources in the database. These locks can be local to one instance or global to a database. They are associated with a session or transaction, and can be in any mode: shared, exclusive, protected read, protected write, concurrent read, concurrent write, or null.

what is Resource? :

Object to which access must be controlled at instance level

what is Enqueue? :

Memory structure that serializes access to a resource

what is Global Resources?:

Object to which access must be controlled at cluster level

what is Global Enqueue?:

Locks and enqueues which need to be consistent across all the instances

Resource mastering:

Real Real Application Clusters, every resource is associated with a master node.  Resource is assigned based on its resource name to one of the instances that acts as the master for the resource:

Resource affinity:

Resource is  dynamically move to other  instance where resource operations are most frequently used to minumize the internode message traffic. This was done by both Global Cache Service(GCS) and Global Enqueue Service (GES)

Global Cache Services (GCS) : Implements cache coherency for database, It coordinates access to database blocks  for instances.

The GCS and GES nominate one instance to manage all information about a particular resource. This instance is called the resource master. The GCS evaluates resource mastering periodically and changes the resource master based on data access patterns.

LMSn : Global Cache Service Process is background process.

  • Manage requests for data access across cluster
  • GCS server processes can be configured using gcs_server_processes parameter
  • In oracle 10.2 version There are 36 Process available (LMS0-LMS9 LMSa-LMSz)


Code

Lock Name

BL

Buffer Cache Management

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: