function ALERT {
export DB1=$ORACLE_SID
export DB=$(echo $ORACLE_SID|tr '[A-Z]' '[a-z]' |sed -e '$s/.$//')
export ASMDB=rdbms
if [ "$DB" = "+asm" ]; then export ASMDB=asm ; fi
if [ "$DB" = "+as" ]; then export ASMDB=asm ; export DB="+asm"; fi
[ -d "$ORACLE_BASE/diag/$ASMDB/$DB/$ORACLE_SID/trace" ] && view $ORACLE_BASE/diag/$ASMDB/$DB/$ORACLE_SID/trace/alert_$ORACLE_SID.log ||view $ORACLE_BASE/diag/$ASMDB/$DB1/$ORACLE_SID/trace/alert_$ORACLE_SID.log
}
Notes:
* Works in both RAC and non-RAC.
* Works for ASM and non-ASM instances.
* The ALERT function will open the alert log associated with your current ORACLE_SID
** Requirements:
1. ORACLE_BASE must already be set
2. Add this script to your .profile or .bash_profile depending on the shell you are using
Posted by Charles Kim, Oracle ACE Director