Sometimes it’s necessary to read the information from the alert log together with the timestamp of the error.
The very simple Unix-shell script helps to do this:
echo
echo ‘Enter # of lines:’
read NUM
tail -$NUM alert_${ORACLE_SID}.log | awk ‘
BEGIN {prev="" ; ret=1 }
/^(…-|Error)/ { if ( prev !~ /^(…-|Error)/ ) { print "" ; print prev;} print $0;ret=0} [...]
The following undocumented function could be used to write to the alert log:
EXECUTE <strong>sys.dbms_system.ksdwrt</strong>(code, message);
Parameters:
1 – Write to trace file.
2 – Write to alertlog.
3 – Write to both.
Example:
EXECUTE sys.dbms_system.ksdwrt(2,TO_CHAR(SYSDATE, ‘Dy Mon DD HH24:MI:SS YYYY’)||’Hello!’ );
CREATE OR REPLACE TRIGGER trg_delme
BEFORE UPDATE ON frodo.delme
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
sys.dbms_system.ksdwrt(2,TO_CHAR(SYSDATE, ‘Dy Mon DD HH24:MI:SS [...]