The SQL Trace function is an on-demand log of selected SQL statements that are issued against the database through the Open SQL Engine. The SQL Trace can be switched on or off dynamically. The log format is database independent. Besides the SQL statement text, each log record contains information about the point in time when the statement was executed, its duration, its input parameters and results (where applicable) as well as context information.
The SQL Trace is especially useful for Development and Performance analysis.
Steps to follow for applying SQL Trace:
– Launch the SQL Trace application.
– Activate the SQL Trace.
– Run the application that you want to trace.
– Deactivate the SQL Trace.
– Set filters optionally.
– Evaluate the trace.
Lets follow the steps and trace the SQL:
(i) Launch the SQL Trace application – with T-Code ST05.
Following function can be performed on the Initial Screen:
Select trace Mode:
· Select the trace mode SQL Trace, Enqueue Trace, RFC Trace, or Table Buffer Trace. You can select multiple trace modes simultaneously.
Select trace function:
· Start the trace recording.
· Stop the trace recording.
· Branch to trace list, detailed list, or time-sorted list.
· Branch to Explain SQL to analyze an SQL statement without an explicit trace file.
(ii) Activate the SQL Trace:
If you want to switch on the trace under your user name, choose Trace on.
If you want to pass on values for one or several filter criteria, choose Trace with Filter.( Typical filter criteria are: the name of the user, transaction name, process name, and program name).
(iii) Run the application that you want to trace. Execute all the screens/steps for which you want to trace.
(iv) Deactivate the SQL Trace – Get back to ST05 and click deactivate button to deactivate the SQL trace. It will stop further / unnecessary SQL recording.
(v) Evaluate the trace by clicking Display Trace. The basic list is displayed at the start.
The displayed result can be drilled down to get more detailed result for better analysis.
Apart from this, summary report can also be generated shown as below.
(vi) Evolving Individual SQL statements:
Click Enter SQL statement to enter the SQL statement you want to evaluate. Enter the SQL and click Explain.
The details of SQL is then displayed.
Summarized Table Information can also be display by clicking the Table Name.