For performance testing purposes - I need to count duration of SQLPlus query. Its not so simple as it seems to be.
I have the code here:
VARIABLE RC REFCURSOR;
EXEC :RC := $aktuellesBericht;
SPOOL ${BERICHT}_${configArray[0]}.DATA
PRINT RC;
SPOOL OFF
It's just a part of the whole command. The whole command looks like this:
sqlplus -s /nolog > /dev/null 2>&1 <<EOF
CONNECT USER/PASSWORD@DATABASE
#A ton of unimportant SET and CLEAR commands goes here#
VARIABLE RC REFCURSOR;
EXEC :RC := $aktuellesBericht;
SPOOL ${BERICHT}_${configArray[0]}.DATA
PRINT RC;
SPOOL OFF
QUIT
EOF
I need to count time of EXEC :RC := $aktuellesBericht; and PRINT RC; separately. Is this even possibe? Can I count it somehow? Let me use some pseudocode showing what I want to do:
execstart = date +%s%N
EXEC :RC := $aktuellesBericht;
execend = date +%s%N
SPOOL ${BERICHT}_${configArray[0]}.DATA
printstart = date +%s%N
PRINT RC;
printend = date +%s%N
SPOOL OFF
exectime=$(( execend - execstart ))
printtime=$(( printend - printstart ))
echo $exectime;
echo $printtime;