Oracle 21c New Feature - The Attention Log

Oracle Database 21c introduced the Database Attention Log (ref).  It is conceptually similar to the Database Alert Log, but it only contains information that requires attention from an administrator, not all of the messages that appear in the alert log.  

The Attention Log is stored outside of the database as a structured text file in your Oracle Automatic Diagnostic Directory.  This file, unlike most of Oracle's logs, is modifiable.

The Database Attention Log is in addition to Oracle's existing logs.  This means each Oracle 21c database now has the following major log files stored on the host filesystem:

  • Alert Log
  • Attention Log
  • DDL Log
  • Debug Log
  • Process Dump and Trace Files

Oracle can also write to the UNIX/Linux syslog facility, and to the Windows Event Viewer.  However, those are partial writes of data found in the Alert Log, so I'm not listing them as distinct log files.  Oracle also writes some alerts internally instead of to host files, such as Server-Generated Alerts that can be seen in database views like DBA_OUTSTANDING_ALERTS.

The Database Attention Log's file name suffix is .log, but unlike traditional logs it is written in a structured format to make it much easier to monitor or process using scripts or automations.  Consider how the Alert Log and DDL Log are each written to two files: plain text and XML.  Historically, all Oracle log files were plain-text, unstructured, and read-only.  The formal structuring of logs began in Oracle 11g with the Alert Log XML format.

The Attention Log is always enabled.  Oracle 21c does not offer an on/off switch or configuration settings.  This is the same as with the database Alert Log and Debug Log.

You can find the Attention Log at $ADR_HOME/trace/attention.log.  In most cases the fully qualified file name is $ORACLE_HOME/diag/rdbms/database_name/instance_id/trace/attention.log.  

You may view the Attention Log's contents manually by opening it in any plain-text editor or dumping the contents with such commands as cat attention.log or grep -i immediate attention.log.  Of course, doing this requires access to the database server filesystem, which often is not possible.

You can also view the Attention Log in SQL*Plus or SQL Developer by querying the view V$DIAG_ALERT_EXT.  Oracle has mapped the view to the Attention Log as an external table.  The below example is from the Oracle documentation referenced earlier:

SELECT attention_id, urgency, target_user, start_version, 
   message_text, cause_text, action_text 
   FROM V$DIAG_ALERT_EXT 
   WHERE urgency = 'IMMEDIATE';

To recap, Oracle 21c introduced a structured text file called the Attention Log with messages for DBA attention that are not as critical as those messages found in the database Alert Log.  The new log file can be edited on the host filesystem by the Oracle software owner, or it can be accessed using a database view by any user granted the DBA role.

Comments

Popular posts from this blog

Using DBGen to Generate TPC-H Test Data

Oracle 21c Caching Solutions

TPC-like Database Benchmarking Tools