It is always a good practice to housekeep the database logs and keep the log file small. In Oracle, alert log can grow to a large size very quickly. So, you can use below script to rotate (just like Unix system log) the alert log.

#!/bin/bash
if [ $# -ne 1 ];then
echo "Usage: `basename $0` "
exit
fi

# Set the Environment
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=${1};
export ORAENV_ASK=NO;
. oraenv;

# Get the location for the alert log
bdump=`${ORACLE_HOME}/bin/sqlplus -s /nolog <connect / as sysdba ;
set head off;
set feedback off;
set verify off;
select value from v\\$parameter where name='background_dump_dest';
exit;
EOF
`
logfile=${bdump}/alert_${ORACLE_SID}.log ;

# Ensure that the background dump dest exists
# If so, rotate the log
if [ -d ${bdump} ]; then
if [ -f ${logfile} ]; then
echo "${logfile} rotated at `/bin/date +%Y%m%d%H%M`" ;
/bin/mv ${logfile} ${bdump}/alert_${ORACLE_SID}.`/bin/date +%Y%m%d%H%M`.log
if [ $? == 0 ]; then
/bin/touch ${logfile};
fi;
else
echo "Alert Log ${logfile} does not exist...";
exit;
fi;
else
echo "Directory does not exist...";
exit;
fi;
date

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati