Monday, September 19, 2016

read time in ora trace files

Writing down a helpfull sed so I don't have to think it again
To convert the time in Oracle traces files. Since 9i it's in microseconds, but hard to read and most of the time milliseconds is enough for me

sed 's/tim=[0-9]*\([0-9][0-9][0-9]\)\([0-9][0-9][0-9]\)[0-9][0-9][0-9]/tim=\1.\2/'  ORA835UD1_ora_2820002.trc

before:

WAIT #4860955944: nam='db file sequential read' ela= 712 file#=6 block#=65257 blocks=1 obj#=109985 tim=45784347843287
WAIT #4860955944: nam='db file sequential read' ela= 710 file#=6 block#=65258 blocks=1 obj#=109985 tim=45784347844097
WAIT #4860955944: nam='db file sequential read' ela= 705 file#=6 block#=65259 blocks=1 obj#=109985 tim=45784347844939
WAIT #4860955944: nam='db file sequential read' ela= 409 file#=6 block#=65260 blocks=1 obj#=109985 tim=45784347845592


after:


WAIT #4860955944: nam='db file sequential read' ela= 712 file#=6 block#=65257 blocks=1 obj#=109985 tim=347.843
WAIT #4860955944: nam='db file sequential read' ela= 710 file#=6 block#=65258 blocks=1 obj#=109985 tim=347.844
WAIT #4860955944: nam='db file sequential read' ela= 705 file#=6 block#=65259 blocks=1 obj#=109985 tim=347.844
WAIT #4860955944: nam='db file sequential read' ela= 409 file#=6 block#=65260 blocks=1 obj#=109985 tim=347.845