Disclaimer

Tuesday, 19 November 2024

GES Vs LMON in Oracle , how it works in Oracle RAC

 

In Oracle RAC, GES (Global Enqueue Service) and LMON (Lock Monitor) are both components that ensure the smooth functioning of the cluster by managing locks and resources across instances. However, they have different roles and responsibilities in the RAC environment. Here's a detailed comparison and explanation of how they work:





1. GES (Global Enqueue Service)

What It Is:

  • GES is a logical service that manages enqueue locks (global locks) for shared resources across RAC instances.

Key Responsibilities:

  1. Global Resource Management:

    • Tracks and controls access to shared resources (e.g., rows, tables, or internal database objects).
  2. Conflict Resolution:

    • Prevents conflicting access to resources by enforcing enqueue lock modes (e.g., shared or exclusive).
  3. Deadlock Detection and Resolution:

    • Detects deadlocks across RAC instances and resolves them by aborting one of the conflicting transactions.
  4. Lock Queuing:

    • Queues requests for locks if a resource is currently locked by another instance.
  5. Synchronization:

    • Ensures all RAC instances have a consistent view of global locks and resource states.




2. LMON (Lock Monitor)

What It Is:

  • LMON is a background process in Oracle RAC responsible for cluster-level lock and resource management tasks.

Key Responsibilities:

  1. Cluster Integrity:

    • Monitors and ensures the health of the RAC cluster by verifying the status of GES and GCS.
  2. Reconfiguration Handling:

    • During node failures or cluster reconfigurations, LMON ensures that resources held by the failed node are released and reallocated to active nodes.
  3. Global Enqueue Directory (GED) Management:

    • Maintains and updates the Global Enqueue Directory, which stores the current state of all locks and resources in the cluster.
  4. Recovery Coordination:

    • Works with other background processes like LMS and LMD to recover locks and resources after node failures.
  5. Heartbeat Monitoring:

    • Tracks the health of RAC nodes and initiates recovery processes if it detects node failures.


Key Differences Between GES and LMON








How They Work Together in RAC

  1. GES in Action:

    • When multiple instances try to access the same resource, GES enforces lock rules:
      • Grants the lock to the requesting instance if it's available.
      • Queues requests if the lock is currently held in a conflicting mode.
      • Resolves deadlocks by killing one of the conflicting transactions.
  2. LMON in Action:

    • Monitors the health of the cluster to ensure that all nodes are functioning.
    • If a node fails:
      • LMON coordinates with other processes to release locks held by the failed node.
      • Updates the GED to reflect the reallocation of resources.
    • If the cluster configuration changes (e.g., a node is added or removed), LMON initiates a cluster reconfiguration.



Example Scenarios

GES in Action:

  • Instance A locks a row for an update. Instance B tries to lock the same row.
    • GES queues the request from Instance B.
    • When Instance A releases the lock, GES grants it to Instance B.

LMON in Action:

  • Instance A crashes while holding locks on multiple resources.
    • LMON detects the failure and releases those locks so other instances can access the resources.



Monitoring GES and LMON

  • GES Views:

    • GV$GES_RESOURCE: Shows global resource information.
    • GV$GES_BLOCKING_ENQUEUE: Displays information about blocked enqueues.
  • LMON Monitoring:

    • Logs in the alert log and trace files will provide information about cluster reconfigurations and failures handled by LMON.


Summary

  • GES is responsible for managing locks and resolving resource conflicts across RAC instances.
  • LMON oversees the health and integrity of the RAC cluster, ensuring resources are reallocated and locks are recovered during node failures or reconfigurations.

Together, they ensure that Oracle RAC maintains a consistent, reliable, and efficient environment for accessing shared resources across multiple nodes.


No comments:

Post a Comment

How to recovery PDB when PDB database is dropped in Oracle

  How to recovery PDB when PDB database is dropped :) [oracle@rac01 ~]$ sqlplus '/as sysdba' SQL*Plus: Release 21.0.0.0.0 - Product...