Disclaimer

Tuesday, 19 November 2024

LMSn, LMD, LMON, LCK, DIAG - RAC Background Process

 

In Oracle RAC, the background processes you’ve listed (LMSn, LMD, LMON, LCK, DIAG) are essential for ensuring that the cluster nodes work together efficiently, managing locks, resources, and the communication between nodes. 

Below is an explanation of each of these background processes, along with how to monitor them, and their interactions with GCS (Global Cache Service), GES (Global Enqueue Service), and GRD (Global Resource Directory).




1) LMSn (Lock Manager Server)

  • What It Is:

    • LMSn is a background process running on each Oracle RAC instance (node). The "n" suffix indicates that there can be multiple LMS processes on each node.
  • Role and Responsibilities:

    • Cache Fusion: LMS manages shared memory between nodes, allowing them to access and modify data blocks across instances.
    • Lock Management: Handles the locks on data blocks (for example, when one instance needs to access a block that another instance is holding).
    • Coordination: Works to coordinate the cache copies of data blocks across all RAC nodes and ensures data consistency.
  • How Many Can Run on Each Node?

    • By default, one LMS process runs for each node in the RAC environment. However, in some configurations, multiple LMS processes can be launched depending on workload and system resources.
  • How to Monitor LMSn:

    • You can monitor LMSn processes through dynamic views like:

      SELECT * FROM gv$lock;
      This will show information about lock types and states across all instances.
  • Works With:

    • GCS (Global Cache Service): LMS works with GCS to manage data block consistency. GCS is responsible for caching the data blocks and ensuring that changes made by one instance are visible to other instances.
    • GES (Global Enqueue Service): While LMS handles data block locking, GES handles higher-level locks, such as those for database objects (tables, rows). LMS and GES work together to coordinate access to data.






2) LMD (Lock Manager Daemon)

  • What It Is:

    • LMD is a background process in Oracle RAC that manages the global locking mechanisms in the cluster.
  • Role and Responsibilities:

    • Global Locking: LMD manages and tracks global locks that are used across all RAC instances. These locks ensure that only one instance can modify a resource at a time (e.g., a data block).
    • Coordination: It coordinates lock requests from different nodes, ensuring that no conflicting operations occur.
    • Lock Management: LMD tracks lock ownership and releases locks when they're no longer needed.
  • How to Monitor LMD:

    • You can check LMD status using dynamic views like:

      SELECT * FROM gv$lock; SELECT * FROM gv$enqueue_resources;
  • Works With:

    • GES (Global Enqueue Service): LMD and GES work together to manage locks across multiple instances. While GES manages the enqueue locks for database objects, LMD tracks and grants global locks for resources like memory structures and database caches.






3) LMON (Lock Monitor)

  • What It Is:

    • LMON is a background process that monitors the status of the cluster and ensures that locks are properly managed, especially during node failures.
  • Role and Responsibilities:

    • Cluster Monitoring: LMON checks the health of the Oracle RAC cluster, ensuring all nodes are up and running.
    • Node Failures: If a node fails, LMON handles the cleanup by releasing locks and ensuring resources are reassigned to the remaining active nodes.
    • Global Resource Tracking: It ensures that all global locks and resources are accounted for and released when nodes fail.
  • How to Monitor LMON:

    • LMON’s status is typically shown in the alert logs, where you can check if there are any node failures or reconfigurations:

      SELECT * FROM gv$active_instances;
  • Works With:

    • GCS (Global Cache Service): Works with GCS to ensure that cache consistency is maintained during node failures. If a node fails, LMON triggers cache recovery and redistributes data blocks.
    • GES (Global Enqueue Service): If a node fails, LMON ensures that any locks held by the failed node are released, and resources are made available to the remaining nodes.






4) LCK (Lock)

  • What It Is:

    • LCK is a background process in Oracle RAC that handles the locking of data at a low level.
  • Role and Responsibilities:

    • Lock Management: Ensures that locks are applied to database objects (like rows and tables) when needed to prevent data conflicts.
    • Conflict Resolution: Manages lock queuing and resolves conflicts between requests from different instances.
  • How to Monitor LCK:

    • You can monitor LCK activity through the gv$lock and gv$enqueue_resources views.
  • Works With:

    • GES (Global Enqueue Service): LCK works with GES to manage the locks on resources, ensuring that no two instances can modify the same data at the same time.






5) DIAG (Diagnostic)

  • What It Is:

    • DIAG is the diagnostic background process responsible for collecting logs and diagnostic data in Oracle RAC.
  • Role and Responsibilities:

    • Diagnostics: Collects trace and log information related to the Oracle RAC environment, including error messages, node failures, and resource issues.
    • Health Monitoring: DIAG helps Oracle support and administrators by storing log data to diagnose and troubleshoot issues.
  • How to Monitor DIAG:

    • Check the Oracle diagnostic directory for logs and trace files located under the oracle_base/diag directory.





Interaction with GCS, GES, and GRD

  • GCS (Global Cache Service):

    • GCS manages the global cache and ensures consistency across instances. LMS, LMD, and LMON all interact with GCS to handle cache consistency during data access and modification.
  • GES (Global Enqueue Service):

    • GES manages locks on resources such as tables, rows, and other objects. LMS and LMD handle enqueue locks, and LCK helps with the lock management on lower levels of the database objects.
  • GRD (Global Resource Directory):

    • GRD is a centralized directory that keeps track of the resources and locks held by each instance in the cluster. LMD and LMS work closely with GRD to manage resource allocation and coordinate lock assignments across RAC instances.




Summary


Background ProcessRoleWorks WithHow to Monitor

LMSn


Manages cache fusion and data block locking.
GCS (Global Cache Service)gv$lock, gv$enqueue_resources

LMD


Manages global locks and coordinates lock requests.


GES (Global Enqueue Service)

gv$lock
, gv$enqueue_resources


LMON



Monitors cluster health and manages node failures.


GCS, GES


Alert logs, gv$active_instances


LCK



Handles locking of data objects (rows, tables).


GES (Global Enqueue Service)


gv$lock
, gv$enqueue_resources



DIAG




Collects diagnostic data and logs for troubleshooting.




None (stands alone for diagnostics)




Diagnostic logs (oracle_base/diag)




Each of these processes plays a critical role in ensuring that Oracle RAC functions smoothly, from lock management and cache consistency to node failure detection and diagnostics. These processes work together with GCS, GES, and GRD to provide a robust, high-availability database environment 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...