Consistent get trace file parser
Similar to my last post, this relates to another posting http://hoopercharles.wordpress.com/2011/01/24/watching-consistent-gets-10200-trace-file-parser. Tracing the event 10200 allows to see consistent reads. For details read linked blog entry. So now I also learned how to quote source code and < and >.
My contribution to the topic, added as comment in above mentioned post, a small awk script, that allows direct parsing of the trace file output on unix (although, I actually used it on cygwin …., so may be not 100% compatible).
In order to change to another trace file format, you just have to change $nr references in the script.
$ more cons_get_trc.awk
BEGIN {
FS ="[ \t<>:]+"
print "Details for file: " trcfile
print "---------------------------------"
while( getline < trcfile != EOF ){
if ( $0 ~ /started for block/ ) {
rdba[$6]+=1
obj[$8]+=1
both[$6","$8]+=1
print $6 " " rdba[$6] ", " $8 " " obj[$8]
}
}
close (trcfile)
print ""
print ""
print "Summary rdba and obj for file: " trcfile
print "---------------------------------"
for ( var in both) {
print var " " both[var]
}
print ""
print "Summary obj for file: " trcfile
print "---------------------------------"
for ( var in obj ) {
print var " " obj[var]
}
}
One third code, two thirds output. Usage demonstration, with just head -50 of a trace file into small.trc. (header info removed below)
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production ....... ktrget2(): started for block <0x0104 : 0x09e3d4cc> objd: 0x00189fa5 env: (scn: 0x05b5.3bb87c76 xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 statement num=0 parent xid: xid: 0x0000.000.00000000 scn: 0x0000.00000000 97sch: scn: 0x0000.00000000 mascn: (scn: 0x0000.00000000) ktrexf(): returning 9 on: 10a102abc scn: 0xffff.ffffffff xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 scn: 0xffff.ffffffff sfl: 0 ktrgcm(): completed for block <0x0104 : 0x09e3d4cc> objd: 0x00189fa5 ktrget2(): completed for block <0x0104 : 0x09e3d4cc> objd: 0x00189fa5 ktrget2(): started for block <0x0104 : 0x09fa4692> objd: 0x00189fa5 env: (scn: 0x05b5.3bb87c76 xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 statement num=0 parent xid: xid: 0x0000.000.00000000 scn: 0x0000.00000000 96sch: scn: 0x0000.00000000 mascn: (scn: 0x0000.00000000) ktrexf(): returning 9 on: 10a102abc scn: 0xffff.ffffffff xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 scn: 0xffff.ffffffff sfl: 0 ktrgcm(): completed for block <0x0104 : 0x09fa4692> objd: 0x00189fa5 ktrget2(): completed for block <0x0104 : 0x09fa4692> objd: 0x00189fa5 ktrget2(): started for block <0x0104 : 0x0a0ac450> objd: 0x00189fa5 env: (scn: 0x05b5.3bb87c76 xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 statement num=0 parent xid: xid: 0x0000.000.00000000 scn: 0x0000.00000000 96sch: scn: 0x0000.00000000 mascn: (scn: 0x0000.00000000) ktrexf(): returning 9 on: 10a102abc scn: 0xffff.ffffffff xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 scn: 0xffff.ffffffff sfl: 0 ktrgcm(): completed for block <0x0104 : 0x0a0ac450> objd: 0x00189fa5 ktrget2(): completed for block <0x0104 : 0x0a0ac450> objd: 0x00189fa5 ktrget2(): started for block <0x0104 : 0x009d94fc> objd: 0x00189fa5 env: (scn: 0x05b5.3bb87c76 xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 statement num=0 parent xid: xid: 0x0000.000.00000000 scn: 0x0000.00000000 96sch: scn: 0x0000.00000000 mascn: (scn: 0x0000.00000000) ktrexf(): returning 9 on: 10a102abc scn: 0xffff.ffffffff xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 scn: 0xffff.ffffffff sfl: 0 ktrgcm(): completed for block <0x0104 : 0x009d94fc> objd: 0x00189fa5 ktrget2(): completed for block <0x0104 : 0x009d94fc> objd: 0x00189fa5 ktrget2(): started for block <0x0104 : 0x09fa4698> objd: 0x00189fa5 env: (scn: 0x05b5.3bb87c76 xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 statement num=0 parent xid: xid: 0x0000.000.00000000 scn: 0x0000.00000000 96sch: scn: 0x0000.00000000 mascn: (scn: 0x0000.00000000) ktrexf(): returning 9 on: 10a102abc scn: 0xffff.ffffffff xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 scn: 0xffff.ffffffff sfl: 0 ktrgcm(): completed for block <0x0104 : 0x09fa4698> objd: 0x00189fa5 ktrget2(): completed for block <0x0104 : 0x09fa4698> objd: 0x00189fa5 ktrget2(): started for block <0x0104 : 0x009d94ff> objd: 0x00189fa5 env: (scn: 0x05b5.3bb87c76 xid: 0x0000.000.00000000 uba: 0x00000000.0000.00 statement num=0 parent xid: xid: 0x0000.000.00000000 scn: 0x0000.00000000 96sch: scn: 0x0000.00000000 mascn: (scn: 0x0000.00000000)
$ awk -v trcfile=small.trc -f cons_get_trc.awk
Details for file: small.trc --------------------------------- 0x09e3d4cc 1, 0x00189fa5 1 0x09fa4692 1, 0x00189fa5 2 0x0a0ac450 1, 0x00189fa5 3 0x009d94fc 1, 0x00189fa5 4 0x09fa4698 1, 0x00189fa5 5 0x009d94ff 1, 0x00189fa5 6 Summary rdba and obj for file: small.trc --------------------------------- 0x0a0ac450,0x00189fa5 1 0x09fa4698,0x00189fa5 1 0x09fa4692,0x00189fa5 1 0x009d94ff,0x00189fa5 1 0x009d94fc,0x00189fa5 1 0x09e3d4cc,0x00189fa5 1 Summary obj for file: small.trc --------------------------------- 0x00189fa5 6