#!/bin/ksh #******************************************************************************* # KSH PROGRAM #******************************************************************************* # # PROGRAM ID : analyze_dpimp_log.ksh # #D DESCRIPTION : Analyze Data Pump import log files #D - show number of each ORA-xxxxx error and (maximum) #D - the first 10 occurrences (10 is default, can be #D changed with 2nd input parameter) #D # # INPUT PARAMETERS : $1 - $si_logfile (name of the log file) # $2 - $si_maxcnt (number of lines to be displayed for each error # # OUTPUT PARAMETERS : none # # # INPUT FILES : $si_logfile (name of the log file) # # OUTPUT FILES : none # # # SPECIAL LOGIC NOTES : none # #******************************************************************************* # MODIFICATION LOG # # # DATE SE # DESCRIPTION # --------------------------------------------------------------------------- # Thu Feb 4 11:24:41 CET 2016 (Hajo) # typo correction # --------------------------------------------------------------------------- # Mon Dec 14 09:51:17 CET 2015 (Hajo) # initial version # --------------------------------------------------------------------------- # #******************************************************************************* #******************************************************************************* # INITIALIZATION #******************************************************************************* export s_parmcount=$# export s_myname=`basename $0` export s_parmcount_expected=1 if [[ $s_parmcount -lt $s_parmcount_expected ]] then print -u2 "${s_myname}: USAGE: ${s_myname} or" print -u2 " ${s_myname} !" exit 1 else export si_logfile=$1 export si_maxcnt=$2 if [ "${si_maxcnt}" = "" ] then export si_maxcnt=10 fi fi #******************************************************************************* # MAINLINE #******************************************************************************* grep ORA- ${si_logfile} | awk '{print $1}' | sed -e's/\://' | sort -u | while read s_oerr do echo ${s_oerr} echo "=========" # ---> error count s_errcnt=$(grep ${s_oerr} ${si_logfile} | wc -l) if [[ ${s_errcnt} -gt ${si_maxcnt} ]] then export s_maxcnt=${si_maxcnt} export s_closingline="---> ATTENTION: Only the first ${si_maxcnt} occurrences of <${s_oerr}> are displayed above!" else export s_maxcnt=${s_errcnt} export s_closingline="---> No more occurrences of <${s_oerr}>." fi echo "--> OCCURANCE (${s_maxcnt} of ${s_errcnt}):" grep ${s_oerr} ${si_logfile} | head -${s_maxcnt} echo ${s_closingline} echo "" echo "" done