ORACLE tkprof utility can read multiple SQL trace files

Don’t we all command line workers get angry when a command google:”can’t read from stdin”? I thought oracle’s google:”tkprof” is one such command. I was wrong! This is very useful when there are many small SQL trace files or when one wants to tkprof zipped trace file as is, like below. I checked the generated file content briefly and as far as I can tell, aggregation was done correctly.

$ echo *.trc | wc -w
220
$ cat *.trc | wc -l
3391365
$ cat *.trc | tkprof /dev/stdin all.tkprof
$ tail all.tkprof
280  sessions in tracefile.
3150861  user  SQL statements in trace file.
79974  internal SQL statements in trace file.
17923  SQL statements in trace file.
4434  unique SQL statements in trace file.
3391365  lines in trace file.
$ (gzcat orcl_ora_9120.trc.gz && gzcat orcl_ora_9845.trc.gz) | wc -l
6829778
$ (gzcat orcl_ora_9120.trc.gz && gzcat orcl_ora_9845.trc.gz) | tkprof /dev/stdin /tmp/test.tkprof
$ tail /tmp/test.tkprof
3  sessions in tracefile.
50078  user  SQL statements in trace file.
47  internal SQL statements in trace file.
30583  SQL statements in trace file.
8920  unique SQL statements in trace file.
6829778  lines in trace file.
15995  elapsed seconds in trace file.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s