Created
April 13, 2010 18:57
-
-
Save neilkod/364935 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ksh | |
# | |
# Name: multiple_tkprof.sh | |
# Author: Kodner | |
# Date: 13-Apr-2010 | |
# Purpose: | |
# | |
# Take all of the trace files with an identifier and run tkprof on them | |
# giving each output file an intelligent name - charging_date_serialNum.out. | |
# We're going to use the default sort on all of the tkprofs | |
# because I want to view the queries in the same order for each run. | |
# | |
# We grab the serial number from the session using awk. | |
# Same with the date of the file. | |
# Nothing fancy, this took all of about 2 minutes to write | |
# | |
# $1 is the a part of the tracefile name. It could be the sid. In my case | |
# I trace after setting a tracefile identifier. | |
# If I want to tkprof all of the traces labeled charging I would run | |
# > tkprof_multiple.sh charging | |
# | |
# For now, this will only work in the current directory. If needed | |
# the script can determine the value of udump based on $ORACLE_SID. | |
# | |
# | |
if [[ $1 = '' ]] | |
then | |
printf "\n\t usage <tracefile_identifier>\n\n" | |
exit | |
fi | |
for i in `ls *$1*.trc` | |
do | |
serialNum=`echo $i|awk -F_ {'print $3'}` | |
dt=`ls -l $i|awk '{print $6"_"$7}'` | |
tkprof $i ${1}_${dt}_${serialNum}.out sys=no | |
echo $dt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment