Wednesday, 30 March 2011

Three ways to tail the alert log in Oracle 11g

The Oracle 11g database offers us several choices in reading the alert log of the database.

1. You can read the last 200 lines from sqlplus using the folowing sql.

select * from (
select record_ID,message_text from X$DBGALERTEXT
order by record_ID desc
)
where rownum <=200
order by record_ID asc

It's something like tail -n 200 alert_SID.log


2. Oracle 11g introduces the adrci, a diagnostic utility so that you can see the alerts from different logs. It also can be customized very easely. The simpelest way to read the last 200 lines from the alert log with the follow option is:


[oracle@oracle11gdb ~]$ adrci


ADRCI: Release 11.1.0.6.0 - Beta on Wed Mar 30 14:59:02 2011


Copyright (c) 1982, 2007, Oracle.  All rights reserved.


ADR base = "/db/app/oracle"
adrci> show log -tail 200 -f



3. The clasic way, using the tail command, but now the file is in a differen location:

$ORACLE_BASE/diag/rdbms/DBNAME/ORACLE_SID/trace/alert_SID.log

so, the command might be:

tail -fn 200  $ORACLE_BASE/diag/rdbms/db11g/db11g/trace/alert_db11g.log

1 comment: