Saturday, January 10, 2015

Find and Monitoring Oracle Alert Log Using External Table.

SQL> show parameter background
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_core_dump                 string      partial
background_dump_dest                 string      /u01/app/oracle/diag/rdbms/orcl/orcl/trace
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@DB ~]$ ls  /u01/app/oracle/diag/rdbms/orcl/orcl/trace/al*
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log

[oracle@DB ~]$

CREATE DIRECTORY ALERT_LOG AS '/u01/app/oracle/diag/rdbms/orcl/orcl/trace/';
 CREATE TABLE
    ALERT_LOG ( MESSAGE VARCHAR2(3000) )
 ORGANIZATION EXTERNAL (
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY ALERT_LOG
    ACCESS PARAMETERS (
       RECORDS DELIMITED BY NEWLINE
    )
    LOCATION('alert_orcl.log')
 )
 REJECT LIMIT 1000;

SELECT ROWNUM , MESSAGE
FROM ALERT_LOG
ORDER BY 1 DESC

No comments:

Post a Comment