Viewing an Alert Log from ADRCI:
==========================
You want to view an alert log by using ADRCI commands.
To view an alert log with ADRCI, follow these steps:
Invoke ADRCI.
$ adrci
Set the ADR home with the set homepath command.
adrci> set homepath diag/rdbms/orcl/orcl
Enter the following command to view the alert log:
adrci> show alert
ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
Output the results to file: /tmp/alert_3573_13986_orcl_1.ado
adrci>
show alert
The alert log will pop up in your default editor. The ADRCI prompt will return once you close the text file in the
editor.
You can also query the V$DIAG_INFO view to find the path that corresponds to the Diag Trace entry. You can
change the directory to that path and open the alert_<db_name>.log file with a text editor.
How It Works
The alert log holds runtime information for an Oracle instance and provides information such as the initialization
parameters the instance is using, as well as a record of key changes such as redo log file switches and, most
importantly, messages that show Oracle errors and their details. The alert log is critical for troubleshooting purposes,
and is usually the first place you’ll look when a problem occurs. Oracle provides the alert log as both a text file as well
as an XML-formatted file.
The show alert command brings up the XML-formatted alert log without displaying the XML tags. You can set
the default editor with the SET EDITOR command, as shown here:
adrci> set editor notepad.exe
The previous command changes the default editor to Notepad. The show alert -term command shows the
alert log contents in the terminal window. If you want to examine just the latest events in the alert log, issue the
following command:
adrci>show alert -tail 50
The tail option shows you a set of the most recent lines from the alert log in the command window. In this
example, it shows the last 50 lines from the alert log. If you don’t specify a value for the tail parameter, by default, it
shows the last 10 lines from the alert log.
The following command shows a “live” alert log, in the sense that it will show changes to the alert log as the
entries are added to the log.
adrci> show alert -tail -f
The previous command shows the last 10 lines of the alert log and prints all new messages to the screen, thus
offering a “live” display of ongoing additions to the alert log. The CTRL+C sequence will take you back to the ADRCI
prompt.
When troubleshooting, it is very useful to see if the database issued any ORA-600 errors. You can issue the
following command to trap the ORA-600 errors.
adrci> show alert -p "MESSAGE_TEXT LIKE '%ORA-600%'"
Although you can view the alert log directly by going to the file system location where it’s stored, you can also
do so through the ADRCI tool. ADRCI is especially useful for working with the trace files of an instance. The SHOW
TRACEFILE command shows all the trace files in the trace directory of the instance. You can issue the SHOW TRACEFILE
command with various filters—the following example looks for trace files that reference the background process mmon:
$ adrci> show tracefile %mmon%
diag\rdbms\orcl1\orcl1\trace\orcl1_mmon_1792.trc
diag\rdbms\orcl1\orcl1\trace\orcl1_mmon_2340.trc
adrci>
This command lists all trace files with the string mmon in their file names. You can apply filters to restrict the
output to just the trace files associated with a specific incident number (the next recipe, Recipe 7-11, explains how to
get the incident number), as shown here:
adrci> show tracefile -I 43417
diag\rdbms\orcl1\orcl1\incident\incdir_43417\orcl1_ora_4276_i43417.trc
adrci>
The previous command lists the trace files related to the incident number 43417.