Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Trace

Former Member
0 Kudos
167

Can anyone tell me how to use SQL Trace with detailed steps.

3 REPLIES 3

Former Member
0 Kudos
94

Former Member
0 Kudos
94

Hi

SQL Trace

SQL trace(ST05) provides the developer with the ability to analyse database select statements. Simply execute ST05

to turn on SQL trace, then execute the statement/program you want to analyse. Now turn off SQL trace using ST05

and click on list trace to view the details.

You can also perform traces on other items such as authorisation objects.

Authorisation trace analysis 1. Open two sessions

2. Execute transaction ST01 in one of the sessions

3. Select the authorisation checkbox, note the other traces

you can perform (SQL, RFC, Table Buffer etc)

4. Click the 'Trace On' button

5. Within your other session execte the transaction/report

you want to trace or get the user in question to do it

6. Return to the session where you turned the trace on and

click on 'Trace Off' otherwise it will continue to record

all athorisation checks

7. Click on the 'Analysis' button

8. Enter appropriate data into selection screen such as

Username, type of trace records (i.e. Authorization check)

9. Click on the Execute button.

10. Report displaying trace results will now be displayed

http://www.sapdevelopment.co.uk/perform/perform_sqltrace.htm

Some useful transaction related to this are ..

ST01 SAP system trace

ST02 Buffer statistics.

ST03 Workload analysis.

ST04 Database performance analysis.

ST05 SQL trace .

ST06 Operating system monitor ...

From the recorded SQL trace you can deduce:

· Which SQL statements your application carries out

· Which values the system uses for specific database accesses and changes

· How the system translates ABAP OPEN SQL commands (such as

SELECT) into standard SQL commands

· Where your application positions COMMIT statements

· Where your application makes repeated database accesses

· What database accesses or changes occur in the update section of your

application

Look at the below links, you will get the idea

http://help.sap.com/saphelp_erp2005/helpdata/en/d1/801f89454211d189710000e8322d00/content.htm

http://www.sapbrain.com/TOOLS/SQLTRACE/SQL_TRACE.html

Check the following links:

http://www.sapbrainsonline.com/TOOLS/RUNTIMEanalysis/SAP_runtime_analysis.html

http://www.sapbrainsonline.com/TOOLS/SQLTRACE/SQL_TRACE.html

Regards

Anji

Former Member
0 Kudos
94

Hi,

The SQL trace is a tool, which allows displaying and analyzing the contents for the database calls, which are made by the reports and transactions written in ABAP/4. It monitors programs and transactions on the database level. With the help of this facility for every open SQL instructions, you can display, about which SQL Embedded (DECLARE, OPEN, FETCH) Statement have been executed, besides analyzing the system performance.

Steps to Creation

• From R3 screen, select system –-> Utilities –-> SQL trace. Or Enter transaction ST05.

• Click the trace on button.

• Enter the user name whose programs are going to be traced.

• Execute the program or transaction you want to trace.

• Return to SQL trace initial screen and press the button SQL trace off. This switching off is necessary because if it is not done then SQL trace will trace each and every program executed by a particular user. And it is quite expensive in terms of memory and time of the system.

Analyzing The Trace File

To analyze the created trace, press the button list trace. Using this file you can see exactly how the system handles database requests. The first screen of the SQL trace data file displays each measured database requests, the application made. The trace file records when the request occurred and its duration.

To display dictionary definition information about the table field, position the cursor on the table field and click on the DDIC info button. When this button is clicked, it displays system information like object name, table class, whether buffering is allowed or not i.e. information related to dictionary.

Explain SQL: This button provides the functionality, which includes the utility for providing detailed information about the SQL Operation Strategy followed by the underlying database system. You need to click on Explain SQL button. The system displays the execution plan for SQL statements. Here you can display the actual SQL statement like Select, which fields are being accessed, Table being accessed, all where conditions.

ABAP/4 Display Gives you the actual ABAP/4 code.

More information gives the detailed information for time, select statement, client, number of records selected etc. Replace variable will display the SQL statement with another variables.

I think this may be helpful for you...