Thursday 9 June 2011

Viewing Realtime Alert Log via ADRCI

ADR (Automatic Diagnostic Repository) was introduced in 11g and is a datastore for diagnostic information for oracle components such as database, asm, listener and scan listeners. It stores trace files, logs in both clear text and xml format. ADR does allow the capability to see alert (and listener) logs in realtime.

For example if I wanted to view in realtime the alert log for Database called RED, I would do the following:
[oracle@lnx01] adrci
adrci> set home RED
adrci> show alert -tail -f
If you have multiple ADR homes and wish to quickly switch between alert or listener logs, I have created a script which can be downloaded called sos_alert.sh. Example of using this script are provided below, but first change to directory to where sos_alert.sh was downloaded to and set executable permission accordingly:
[oracle@lnx01] cd /home/oracle/scripts
[oracle@lnx01] chmod +x sos_alert.sh
Example 1: To view alert log for the database named RED
[oracle@lnx01] ./sos_alert.sh RED
Example 2: To view alert log for ASM
[oracle@lnx01] ./sos_alert.sh +ASM
Example 3: To view listener log for listener named “LISTENER”
[oracle@lnx01] ./sos_alert.sh LISTENER
Example 4: To view listener log for scan listener named “LISTENER_SCAN1″
[oracle@lnx01] ./sos_alert.sh LISTENER_SCAN1