Since Oracle 12c, Oracle has adopted multiple Log Writer (LGWR) processes instead of a single LGWR process to parallelize redo writing from the log buffer to the redo log file. The primary LGWR process delegates operations to helper log writer worker processes (named LGnn). Typically, there are two worker processes in addition to the main LGWR process, as shown below:

$ ps -ef | grep ora_lg | grep yuan
oracle    186756       1  0 Dec03 ?        00:00:30 ora_lgwr_yuan
oracle    186764       1  0 Dec03 ?        00:00:17 ora_lg00_yuan
oracle    186770       1  0 Dec03 ?        00:00:10 ora_lg01_yuan

The parent LGWR process communicates with its worker processes using Inter-Process Communication (IPC) semaphores to wake up sleeping processes. However, in CPU starvation scenarios, the awakened process may struggle to gain access to the CPU and must wait in the CPU run queue, prolonging the overall wait time.

In a CPU-starved Oracle database, wait events related to LGWR workers may prominently appear in the “Background Wait Events” section of an AWR report.

You can revert to the traditional single LGWR background process by setting the following hidden parameter to TRUE:

ALTER SYSTEM SET "_use_single_log_writer" = TRUE SCOPE=SPFILE;

The default value of this undocumented parameter is ADAPTIVE.

Leave a comment

I’m Yuan

Welcome to the blog of a performance maven in Oracle & MySQL. Feel free to contact me to share and discuss database knowledge.

My 20 Oracle Certifications

A screenshot from certview.oracle.com

My Book

MySQL 8.0 Operations and Optimization

Let’s connect