Technology Sharing

Which Oracle background processes cannot be killed?

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Oracle has many background processes. When encountering special situations such as locking a table, if the process waiting is a background process, then you need to consider whether you can kill this background process? Will killing this background process cause the instance to crash? In the spirit of practice, this article targets Oracle 11g, Oracle 19c, and Oracle 23ai, and kills the system's background processes in turn to see if it will cause the instance to crash.

1. Database instance

1.1 Test scripts kill background processes in turn

Killing the well-known pmon, smon, dbwr, lgwr, ckpt, and mman core processes will definitely cause the instance to crash, so these six processes are excluded from the script.

#!/bin/shfunction startup(){    sqlplus / as sysdba<<EOF    startup    exitEOF}started=`ps -ef | grep pmon | grep -v grep | awk '{print $2}'`test -z "$started" && startup >> /dev/nullsleep 5# List of Oracle background processes to exclude from killingexclude_processes="pmon|smon|dbw0|dbw1|lgwr|ckpt|mman"# Get list of Oracle processesprolist=`ps -ef | grep ora | egrep -v "bash|su|h|ps|grep|more|sleep|awk|LOCAL|sy                                                                             sdba|log|$exclude_processes" | awk '{print $NF}'`for i in $prolistdo    proc_key=`echo $i | awk -F _ '{print $2}'`    pid=`ps -ef | grep $proc_key | grep -v grep | awk '{print $2}'`    test -z $pid && echo "$proc_key does not exist" || {        echo "Killing process $proc_key with PID $pid"        kill -9 $pid        sleep 20        # Check if PMON process exists        pc=`ps -ef | grep pmon | grep -v grep | wc -l`        echo "Number of PMON processes: $pc"        if [ $pc -eq 0 ]; then            echo "Killed process $proc_key has caused instance crash!"            startup >> /dev/null            sleep 5        else            echo "Killed process $proc_key has not caused instance crash."        fi    }done


Here are the test results of three versions
oracle 11g

Killed process vktm has caused instance crash!Killed process gen0 has caused instance crash!Killed process dbrm has caused instance crash!

oracle 19c

Killed process clmn has caused instance crash!Killed process vktm has caused instance crash!Killed process gen0 has caused instance crash!Killed process lg00 has caused instance crash!Killed process lg01 has caused instance crash!Killed process lreg has caused instance crash!Killed process dbrm has caused instance crash!Killed process pman has caused instance crash!

oracle 23ai

Killed process clmn has caused instance crash!Killed process vktm has caused instance crash!Killed process gen0 has caused instance crash!Killed process lg00 has caused instance crash!Killed process lg01 has caused instance crash!Killed process lreg has caused instance crash!Killed process dbrm has caused instance crash!Killed process pman has caused instance crash!Killed process bg02 has caused instance crash!

1.2 Summarize which database background processes cannot be killed

oracle11g (9)

Oracle 19c (9+4=13)
 

There is no introduction to bgnn in the official documentation?

  • PMON (Process Monitor):

    • Responsible for monitoring the status of background processes and user processes. When a user process is detected to be abnormal or disconnected, PMON is responsible for cleaning up related resources and releasing the lock.

  • SMON (System Monitor):

    • Handles system-level transactions and database instance recovery. SMON is responsible for maintaining database consistency, including rolling back incomplete transactions and cleaning up temporary segments.

  • DBWR (Database Writer):

    • Responsible for writing the data in the buffer back to disk. DBWR performs checkpoints as needed to ensure the consistency and durability of the database.

  • LGWR (Log Writer):

    • Writes log records in the redo log buffer to the redo log file. LGWR ensures the durability of transactions and allows the database to recover after a crash.

  • CKPT (Checkpoint Process):

    • Responsible for periodically performing checkpoint operations in the database instance. Checkpoints write modified data in the database buffer to data files for recovery operations.

  • MMAN (Memory Manager):

    • Manages memory allocation and usage within a database instance. MMAN is responsible for automatically adjusting the size of the shared pool and other memory structures to optimize database performance.

  • VKTM (Virtual Keeper of Time):

    • Provides time services in the database instance. VKTM manages all time-related operations in the database, including wait events and transaction timestamps.

    • A new background process introduced in Oracle 11g.

  • DBRM (Database Resource Manager):

    • Manages the allocation and use of database resources, including CPU, I/O, and number of connections. DBRM ensures that resources are allocated fairly and efficiently among different users and applications.

    • New background processes introduced in Oracle 11g

  • GEN0 (Generic Background Process):

    • A general background process that handles various system tasks and management operations in a database instance.

    • Background processes introduced by Oracle 10g

    23ai (13+1=14)

    AddedbgnnProcess, 23ai does have multiple background bgnn processes, killing them will cause the instance to crash. It should be a key process, but there is no such process in the official reference? Very strange! If anyone knows, please leave a message to enlighten me!

    • CLMN (Cleanup Main Process)

      • Function: Responsible for performing cleanup tasks in the Oracle instance.

      • Responsibilities: Manages the cleanup of dead processes, terminated sessions, transactions, network connections, idle sessions, detached transactions, and network connections that have exceeded the idle timeout.
        Oracle 12c introduces clnn to assist pmon in handling some cleanup tasks

    • LGnn ( Log Writer Worker)

      • Function:lgwr auxiliary process.

      • Responsibilities: In a multi-processor system, LGWR creates a worker to improve process write performance

      • Oracle19c introduces assistance to LGWR process to handle concurrency and improve log writing performance

    • LREG ( Listener Registration Process)

      • Function: Register the Oracle instance to the listener.

      • Responsibilities: Inform the listener about the instance, service, handler, and endpoint. Ensure that the listener knows the database service to which it can connect.

      • Oracle 12c introduced

    • PMAN (Process Manager)

      • Function: Manage various background processes in the Oracle database.

      • Responsibilities: Monitors, starts, and stops the Distributor and shared server processes, the connection broker, the pooled server processes for the database resident connection pool, the job queue processes, and the restartable background processes as needed.

      • Oracle 12c introduced

2.ASM instance

In addition to the above, there are also background processes related to ASM instances in a cluster environment. There are four key ASM processes that cannot be killed:

  • ASMB (ASM Background Process)

    • Function: ASMB is the background process of Automatic Storage Management (ASM). It is mainly used to maintain the communication between the ASM instance and the Oracle instance. ASMB manages the connection with the Oracle instance, processes metadata operation requests between the ASM instance and the client, and coordinates data rebalancing operations.

  • RBAL (ASM Rebalance Master Process)

    • Function: RBAL is another ASM related process. It is responsible for distributing rebalancing tasks to ARBx slave processes in other ASM instances. Rebalancing operations are performed when ASM disks are added or removed to ensure even distribution of data in the disk group.

  • PSP0 (Process Spawner Process)

    • Function:PSP0 is the Process Spawner Process, which is responsible for generating and managing other background processes in the Oracle instance. It ensures that the required background processes are started when the instance starts and generates new processes when needed.

  • GMON (ASM Disk Group Monitor Process)

    • Function: GMON is the ASM disk group monitoring process. It is mainly used to monitor and manage the status and health of ASM disk groups. GMON ensures the consistency of the disk group and takes corrective measures when errors or inconsistencies in the disk group are detected.

ps :oracle 23aiAnother change is that the name of the background process has been changed from ora_xxxx to db_xxxx, abandoning the rule that has been used for decades.

19c

23ai (Not sure whether the official EE version will use ora_ or db_)