Compare 2 files AWR Report

Hello Experts,

I have a situation to compare 2 text files files (Oracle AWR reports files ) with same column names and only values are different... and I need to write the comparison summary into a new file .. can someone help me here ? Thanks in advance.

Content of the file looks like below

Time Model                             DB/Inst: XXXXX  Snaps: XXX-XXX

                                         SQL Exec                    Hard Parse
  I#    DB time (s)     DB CPU (s)        Ela (s)  Parse Ela (s)        Ela (s) PL/SQL Ela (s)   Java Ela (s)    bg time (s)     bg CPU (s)
---- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- --------------
   1      315,052.6       88,689.9      308,378.2        1,948.7        1,882.5        3,182.8            0.0        2,193.5        1,653.2
   2      280,449.1       90,880.4      272,907.9        2,272.8        2,189.9        7,224.4            0.0        2,072.1        1,622.4
 ~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
 Sum      595,501.8      179,570.3      581,286.1        4,221.6        4,072.4       10,407.3            0.0        4,265.6        3,275.6
 Avg      297,750.9       89,785.1      290,643.1        2,110.8        2,036.2        5,203.6            0.0        2,132.8        1,637.8
 Std       24,468.4        1,549.0       25,081.2          229.2          217.4        2,857.9            0.0           85.8           21.8
                          --------------------------------------------------------------------------------------------------------------------

@Learner3 welcome to forums :b:

On forums we encourage users to add their efforts in form of code in their post which they have put in order to solve their own problem.

So kindly do add your efforts in your question and let us know then, cheers and happy learning on forums.

Thanks,
R. Singh

1 Like

@R.Sing Thanks for your response :slight_smile: Below is the Code which i tried to compare the Timemodel section from the AWR report, But my code is incomplete since am not pretty sure how to compare it... Many thanks in advance for your advice.

#!/bin/ksh
#
CUT=0
type=stats
file1=file1.txt
file2=file2.txt
STAT_B='Time[ _]*Model'                         # Time Model
STAT_E='Time[ _]*Model[ _]*time'    # Time Model

case $type in
  stats|systat|stat|sysstat|systats|sysstats)
      TYPE=stats
      ;;
  sevt|wait|waits)
      TYPE=waits
      ;;
esac

MACHINE=`uname -a | awk '{print $1}'`
case $MACHINE  in
    AIX)
            NAWK=nawk ;;
    *)
            NAWK=awk ;;
esac
echo "Machine $MACHINE "
echo "awk is: $NAWK"

 case $type in
   stats|systat|stat|sysstat|systats|sysstats)
       awk ' /'"$STAT_B"'/, /'"$STAT_E"'/   { print $0 } '
       ;;
   sevt|wait|waits)
       TYPE=waits
       awk  ' /'"$SEVT_B"'/,/'"$SEVT_E"'/ { print $0 } '
      ;;
   *)
      TYPE=unknown
      echo "UNKNOWN TYPE: $type" >&2
      exit
            ;;
 esac > ${TYPE}.cut

echo "type = ${TYPE}"  >&2
cat  ${TYPE}.cut | \
case $type in
  stats|systat|stat|sysstat|systats|sysstats)
       awk $SEP '
          { print $0}
          { print $0}
        '
       ;;
esac  > ${TYPE}.data
cat ${TYPE}.data | \

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.