Welcome to Oracle Database Administrator Home

24x7 oracle database support and solutions
Oracle DBA Home     Routine Maintenance     PostgreSQL     Unix Commands     CVS     Oracle FAQ     Oracle Concepts     SQLPlus     OEM     ASM     Data Guard     RAC     RMAN     Networking     OAS     Partitioning      
Database User Maintenance
Database Space Management
Manage Listener Log
Self managing oracle DB
Manage Alert Log
Cron Jobs
Database Jobs
Oracle Installation
Oracle Database Refresh
Oracle DB COPY
Oracle RMAN backup
Oracle User Profiles
Oracle Unix Scripts
Oracle Materialized View
Oracle troubleshooting SQ
Oracle data Files
oracle Control Files
Sessions and Locks
Managing temp tablespace
Shrink tables in Oracle
alert.log is a text file that can be opened with any text editor. The directory where it is found can be determined by the background_dump_dest  initialization parameter.
 

 Managing Oracle Alert Log Files

 

#!/bin/ksh
# makes a dated copy of the alert log and clears out the original
date=`date +"%m%d%y"`
cp /oradata02/PROD/admin/PROD/bdump/alert_PROD.log /oradata02/PROD/admin/PROD/bdump/alert_PROD.log.$date
rm /oradata02/PROD/admin/PROD/bdump/alert_PROD.log
touch /oradata02/PROD/admin/PROD/bdump/alert_PROD.log

 

remove_old_files.bsh

   #!/bin/bash
  
   # Works for Oracle databases pre-11g
   # 11g introduces universal diagnostic dest
 
   function quit {
     echo "${0} ORACLE_SID DAYS_OLD";
     exit;
   }

   # Make Sure Oracle instance name is passed
   if [ "" == "${1}" ]; then
    quit;
   fi;

   # Make Sure the Days Old argument is passed
   if [ "" == "${2}" ]; then
    quit;
   fi;
  
   # Set the Environment
   export ORACLE_SID=${1};
   export DAYS_OLD=${2};
   export ORAENV_ASK=NO;
   . oraenv;
  
   # Get the location for the bdump
   bdump=`${ORACLE_HOME}/bin/sqlplus -s /nolog <&ltEOF
    connect / as sysdba ;
    set head off;
    set feedback off;
    set verify off;
    select value from v\\$parameter where name='background_dump_dest';
    exit;
    EOF `

   # Get the location for the udump
   udump=`${ORACLE_HOME}/bin/sqlplus -s /nolog <&ltEOF
    connect / as sysdba ;
    set head off;
    set feedback off;
    set verify off;
    select value from v\\$parameter where name='user_dump_dest';
    exit;
    EOF `

    # Make sure the directories are valid and cleanup the files
   if [ -d ${bdump} ] && [ -d ${udump} ] ;  then
     echo "Removing old files at `date +%Y%m%d%H%M` for ${ORACLE_SID}" ;
     echo "Background Dump Before Cleanup `ls -l ${bdump} | wc -l`";
     echo "User Dump Before Cleanup `ls -l ${udump} | wc -l`";
     echo "Listener Log Dump Before Cleanup `ls -l ${ORACLE_HOME}/network/log | wc -l` ";
     find ${bdump} -mtime +${DAYS_OLD} -name "*" -type f -exec rm {} \;
     find ${udump} -mtime +${DAYS_OLD} -name "*" -type f -exec rm {} \;
     find ${ORACLE_HOME}/network/log -mtime +${DAYS_OLD} -name "*" -type f -exec rm {} \;
     echo "Background Dump After Cleanup `ls -l ${bdump} | wc -l`";
     echo "User Dump After Cleanup `ls -l ${udump} | wc -l`";
     echo "Listener Log Dump After Cleanup `ls -l ${ORACLE_HOME}/network/log | wc -l` ";
   fi;