Oracle Alert.Log: How to find it, how to read and write to it from inside the database
Location of the alert.log file
Oracle will write alert.log file to the directory specified by the BACKGROUND_DUMP_DEST parameter.
If this parameter is not set, alert.log will be created in the ORACLE_HOME/rdbms/trace directory.
SQL> show parameter BACKGROUND_DUMP_DEST NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ background_dump_dest string /app/oracle/diag/rdbms/loopds/ /trace
Writing the Alert.Log file
Users can write messages to the alert.log file.
– write message to alert.log exec dbms_system.ksdwrt(2, 'This is a test message.'); PL/SQL procedure successfully completed. – Flush the buffer exec dbms_system.ksdfls; PL/SQL procedure successfully completed.
Selecting content from Alert.Log (11g)
SQL SYS> create view v_$alert_log as select * from x$dbgalertext; SQL SYS> grant select on sys.v_$alert_log to SCOTT; SQL SCOTT> select * from sys.v_$alert_log