Over the years the database alert log has become very overcrowded, making it difficult to filter out the important messages from all the noise. The attention log is a JSON formatted file introduced in Oracle 21c to capture critical events, making system diagnostics easier.
◉ Attention Log Location
There is a single attention log for each database. The location of the attention log can be found by querying the V$DIAG_INFO view. The query below shows all the information from the V$DIAG_INFO view.
Read More: 1Z0-063: Oracle Database 12c - Advanced Administration
set linesize 100 pagesize 20
column name format a25
column value format a70
select name, value
from v$diag_info
order by 1;
NAME VALUE
------------------------- ----------------------------------------------------------------------
ADR Base /u01/app/oracle
ADR Home /u01/app/oracle/diag/rdbms/cdb1/cdb1
Active Incident Count 2
Active Problem Count 1
Attention Log /u01/app/oracle/diag/rdbms/cdb1/cdb1/trace/attention_cdb1.log
Default Trace File /u01/app/oracle/diag/rdbms/cdb1/cdb1/trace/cdb1_ora_12511.trc
Diag Alert /u01/app/oracle/diag/rdbms/cdb1/cdb1/alert
Diag Cdump /u01/app/oracle/diag/rdbms/cdb1/cdb1/cdump
Diag Enabled TRUE
Diag Incident /u01/app/oracle/diag/rdbms/cdb1/cdb1/incident
Diag Trace /u01/app/oracle/diag/rdbms/cdb1/cdb1/trace
Health Monitor /u01/app/oracle/diag/rdbms/cdb1/cdb1/hm
ORACLE_HOME /u01/app/oracle/product/21.0.0/dbhome_1
13 rows selected.
SQL>
We could limit this to just the attention log.
select name, value
from v$diag_info
where name = 'Attention Log';
NAME VALUE
------------------------- ----------------------------------------------------------------------
Attention Log /u01/app/oracle/diag/rdbms/cdb1/cdb1/trace/attention_cdb1.log
SQL>
◉ Attention Log Contents
The attention log contains JSON formatted messages. Here are two example messages from my test database.
{
"ERROR" : "PMON (ospid: 2070): terminating the instance due to ORA error 12752",
"URGENCY" : "IMMEDIATE",
"INFO" : "Additional Information Not Available",
"CAUSE" : "The instance termination routine was called",
"ACTION" : "Check alert log for more information relating to instance termination rectify the error and restart the instance",
"CLASS" : "CDB Instance / CDB ADMINISTRATOR / AL-1003",
"TIME" : "2021-10-13T03:36:50.671+00:00"
}
{
"NOTIFICATION" : "Starting ORACLE instance (normal) (OS id: 1146)",
"URGENCY" : "INFO",
"INFO" : "Additional Information Not Available",
"CAUSE" : "A command to startup the instance was executed",
"ACTION" : "Check alert log for progress and completion of command",
"CLASS" : "CDB Instance / CDB ADMINISTRATOR / AL-1000",
"TIME" : "2021-10-13T10:46:01.949+00:00"
}
We can see the elements present may be different for different types of messages. The documentation breaks these down as follows. I've added my own comments in bold.
◉ Attention ID: A unique identifier for the message. This does not appear to be present in my messages, unless they are classing the "TIME" element as the unique identifier.
◉ Attention type: The type of attention message. Possible values are Error, Warning, Notification, or Additional information. The attention type can be modified dynamically. Rather than having an element called "ATTENTION_TYPE" with a value matching one of these allowable values, we seem to have a combination of the attention type value, and a subject of the message. It's unclear to me what, "can be modified dynamically" means.
◉ Message text: I think this must be the value from the info element.
◉ Urgency: Possible values are Immediate, Soon, Deferrable, or Information. This looks basically OK, but the allowable values in the attention log don't match those listed. It would be nice if they listed the exact allowable values.
◉ Scope: Possible values are Session, Process, PDB Instance, CDB Instance, CDB Cluster, PDB (for issues in persistent storage that a database restart will not fix), or CDB (for issues in persistent storage that a database restart will not fix). I assume this must be the "CLASS" element.
◉ Target user: The user who must act on this attention log message. Possible values are Clusterware Admin, CDB admin, or PDB admin. I don't think this is present, but maybe it's implied by the "CLASS" element?
◉ Cause: Self explanatory.
◉ Action: Self explanatory.
The explanation of the attention log contents is followed by an example message which doesn't match the explanation in the documentation, or the style of message I'm seeing in the 21c attention log.
◉ Attention Log Contents From SQL
There doesn't appear to be a V$ view for the attention log. The documentation suggests using the V$DIAG_ALERT_EXT View, but this is a view over the XML alert log, not the attention log. It is possible to parse this yourself.
◉ Thoughts
Here are some thoughts I had when looking at the attention log.
◉ The documentation for the attention log is rather vague and inaccurate. It looks like it may have been written against a beta version of the database, and not corrected to match the production release.
◉ Different types of messages can contain different elements, which makes parsing the file harder. In the example above we have a message with an "ERROR" element, and another with a "NOTIFICATION" element. It would have been easier if they have kept common element names for each type of message, and just included a "TYPE" element.
◉ The database features application says the attention log comes in JSON and XML format. To find this statement search here for "attention log" and click the resulting "Enhanced Diagnosability of Oracle Database" heading. In the main documentation there is no mention of the XML format, only the JSON formatted file. There are two hidden parameters (_diag_attn_log_format_error and _diag_attn_log_format_standard) that look relevant, but there is no documentation on how to use them, so they are clearly not supported.
◉ The attention log file is located in the "/u01/app/oracle/diag/rdbms/cdb1/cdb1/trace" directory for my database. There is also a "/u01/app/oracle/diag/rdbms/cdb1/cdb1/log/attention" directory, but it contains no files. It's not clear what this directory is for.
Overall, my impression is it's a nice idea, but I'm not sure I agree with the implementation, and the documentation needs a lot of work.
Source: oracle-base.com
0 comments:
Post a Comment