Diagnostic Tools and Traces
Transcript of Diagnostic Tools and Traces
-
7/27/2019 Diagnostic Tools and Traces
1/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 1
Rakesh Tikku
ATS Performance
Performance Tuning :
Diagnostic Tools andTraces
-
7/27/2019 Diagnostic Tools and Traces
2/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 2
Agenda
SQL Trace / TKPROF
PL/SQL Profiler
Forms Runtime Diagnostics
Reports Trace
-
7/27/2019 Diagnostic Tools and Traces
3/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 3
SQL TRACE
-
7/27/2019 Diagnostic Tools and Traces
4/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 4
SQL Trace
It is a diagnostic/debugging facility that provides runtime
performance statistics for individual SQL statements thatyour application runs.
It also records the execution plan that was used to executeeach SQL statement.
In most cases, enabled at the session level.
It is a text file, but raw.
-
7/27/2019 Diagnostic Tools and Traces
5/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 5
SQL Trace
Level 1 - Standard Sql Trace
Level 4 - Level 1 PLUS Bind valuesBINDS #1:
bind 0: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=03 oacfl2=0 size=24offset=0
bfp=80000001000cbc78 bln=22 avl=04 flg=05
value=144867
Level 8 - Level 1 PLUS Wait StatisticsWAIT #1: nam='file open' ela= 0 p1=0 p2=0 p3=0
WAIT #1: nam='db file sequential read' ela= 2 p1=330 p2=121062 p3=1
Level 12 - Level 1 PLUS Bind values and WaitStatistics
In >80% cases, Standard Sql Trace is good enough
-
7/27/2019 Diagnostic Tools and Traces
6/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 6
SQL Trace
sql_trace=false
Enables sql tracing for the entire instance
timed_statistics=true
Enables collection of CPU and elapsed times
max_dump_file_size=val [K|M]|unlimitedSpecifies max size of the trace file
user_dump_dest=
Specifies location where trace files should be written
tracefile_identifier=stringCreates trace files with the name sid_ora_pid_string.trc
_trace_files_public=true
Creates trace files with mode 644 instead of 600
-
7/27/2019 Diagnostic Tools and Traces
7/50
-
7/27/2019 Diagnostic Tools and Traces
8/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 8
Enabling Trace - Forms
Set profile option Uti l i t ies:Diagnost icsto Yes in order to
suppress Apps password prompt.
-
7/27/2019 Diagnostic Tools and Traces
9/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 9
Enabling Trace OA FWK
Set profile FND : Diagnostics to Yes at user level
Login to Self Service as the above user
Click on Diagnostics icon at the top of page
Select Set Trace Level and click Go
Select the desired trace level and click Save
Perform the activity that you want to trace
Exit application
-
7/27/2019 Diagnostic Tools and Traces
10/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 10
Enabling Trace OA FWK
-
7/27/2019 Diagnostic Tools and Traces
11/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 11
Enabling Trace Concurrent Program
-
7/27/2019 Diagnostic Tools and Traces
12/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 12
OAM Debug Workbench
Set Profile option Concurrent : A l low Debugg ingto Yes
OAM minipack H + rollup 1 or later is required.
-
7/27/2019 Diagnostic Tools and Traces
13/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 13
OAM Debug Workbench
-
7/27/2019 Diagnostic Tools and Traces
14/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 14
Enabling Trace Generic Method
Set the profile Initialization SQL Statement Customat
user level to the following valueALTER SESSION SET TRACEFILE_IDENTIFIER=CLASSXX EVENTS ='
10046 TRACE NAME CONTEXT FOREVER, LEVEL '
This will trace all the sessions of that user at level
The trace file name will be of the format :sid_ora_spid_CLASSXX.trc
- It is not recommended to use this method to enable trace for an
application that uses a connection pools as it can dirty the poolwith connections with SQL trace on.
-Examples of applications using connection pools
-OA FWK
-JTF Stack
-
7/27/2019 Diagnostic Tools and Traces
15/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 15
TKPROF
-
7/27/2019 Diagnostic Tools and Traces
16/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 16
TKPROF
Utility that read the raw SQL trace file and produces a user
readable output file
Summarizes information from the raw trace file
Can generate execution plans
-
7/27/2019 Diagnostic Tools and Traces
17/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 17
TKPROF
Contains the following information
The text of the SQL statement.
The SQL trace statistics in tabular form.
The number of library cache misses for the parsing and execution ofthe statement.
The user initially parsing the statement.Runtime Execution Plan, listed under Row Source Operation
The execution plan generated by EXPLAIN PLAN.
Wait Statistics ( 9i onwards )
-
7/27/2019 Diagnostic Tools and Traces
18/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 18
TKPROF
tkprof tracefile outputfile [Optional Params]
Optional ParametersExplain=username/password
Table=.
Sys=yes|no
Sort=sort option(s)
Sort option is a concatenation of cursor operation and statistic type
Operation Statistic Type
PRS parse CNT CountEXE execute CPU CPU Time
FCH fetch ELA Elapsed Time
ROW Number of Rows
DSK Number of Disk Reads
-
7/27/2019 Diagnostic Tools and Traces
19/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 19
TKPROF
Sample Output
select party_name
from
hz_parties where party_id=:b1
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.01 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.06 3 4 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.00 0.07 3 4 0 1
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 33 (APPS)
-
7/27/2019 Diagnostic Tools and Traces
20/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 20
TKPROF
Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS BY INDEX ROWID HZ_PARTIES
1 INDEX UNIQUE SCAN (object id 34093)
Rows Execution Plan
------- ---------------------------------------------------
0 SELECT STATEMENT GOAL: CHOOSE
1 TABLE ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF 'HZ_PARTIES'
1 INDEX GOAL: ANALYZED (UNIQUE SCAN) OF 'HZ_PARTIES_U1'
(UNIQUE)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
db file sequential read 3 0.03 0.06
file open 2 0.01 0.01
SQL*Net message from client 2 9.99 9.99
-
7/27/2019 Diagnostic Tools and Traces
21/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 21
TKPROF
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 538 0.70 0.95 1 670 0 0
Execute 560 4.11 6.20 0 44942 45 224
Fetch 363 0.44 4.34 278 3401 52 1157
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 1461 5.25 11.49 279 49013 97 1381
Misses in library cache during parse: 60
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 4578 4.30 4.71 2 38 3 0
Execute 10944 2.47 3.19 109 1365 3048 580
Fetch 29021 6.49 34.64 2583 287337 1902 29597
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 44543 13.26 42.54 2694 288740 4953 30177
-
7/27/2019 Diagnostic Tools and Traces
22/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 22
TKPROF
Interpreting tkprof Statistics
Each row corresponds to one of the three phases of SQLprocessing
Parse
Execute
Fetch
The columns display the statistic value for each phase
Count
The number of times each statement was parsed, executedor fetched
CPUTotal CPU time in seconds for all parse, execute, or fetch
calls for the statement
Elapsed
Total elapsed time in seconds for all parse, execute, or fetchcalls for the statement
-
7/27/2019 Diagnostic Tools and Traces
23/50 2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 23
TKPROF
Disk
Total number of data blocks physically read from the datafileson disk for all parse, execute, or fetch calls
Query
Total number of buffers retrieved in consistent mode for allparse, execute, or fetch calls
Current
Total number of buffers retrieved in current mode
Rows
Total number of rows processed by the SQL statement
Does not include the rows processed by the sub-queries ofthe SQL statement
The last row displays the totals
-
7/27/2019 Diagnostic Tools and Traces
24/50
-
7/27/2019 Diagnostic Tools and Traces
25/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 25
TKPROF
Interpreting Output - what to look out for
High Physical and Logical reads
High CPU Time
High Elapsed Time
A large gap between elapsed and CPU time indicates that the
server process was waiting for something, most often the waitsare due to the process having to do physical I/O
Check the number of physical reads and try to account for them
Wait statistics (level 8 / level 12 sql trace ) are usually providesufficient information to pin-point the cause
Multiple parse calls for one statement
Multiple execute calls for one statement
-
7/27/2019 Diagnostic Tools and Traces
26/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 26
TKPROF
Misses in library cache during parse -> Hard Parse
Rows fetched per fetchTotals for Non-Recursive and Recursive statements
Check for Throw-away. Throw-away can be caused by:
Full scans
Unselective range scansLate predicate filters
Wrong join order
Late predicate operations
Throw-away Example :Rows Row Source Operation
------- ---------------------------------------------------
11 FILTER
107317043 TABLE ACCESS FULL CFI_RRR_AR_ACTUALS
11 INDEX UNIQUE SCAN SYS_C00307768 (object id 38788)
-
7/27/2019 Diagnostic Tools and Traces
27/50
-
7/27/2019 Diagnostic Tools and Traces
28/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 28
TKPROF
A truncated trace file will provide incomplete information.
Go to the end of the trace file and check for the followingline.
*** DUMP FILE SIZE IS LIMITED TO 12345 BYTES***
Make sure there are not discrepancies between run-time
execution plan and tkprof-generated execution plan
If the trace file has been generated on 9i, use the 9i tkprofexecutable.
-
7/27/2019 Diagnostic Tools and Traces
29/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 29
PL/SQL PROFILER
-
7/27/2019 Diagnostic Tools and Traces
30/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 30
PL/SQL Profiler
API to profile PL/SQL applications and identify performance
bottlenecks Introduced in 8i
Common Causes of PL/SQL performance issues
Initializing large data structures
Passing large data structures as parameters
Leaving code within a loop instead of outside
Using a slow or linear search/sort method
Inefficient Conditional Control Statements
Implicit datatype conversions
-
7/27/2019 Diagnostic Tools and Traces
31/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 31
PL/SQL Profiler - Setting it up
Create the DBMS_PROFILER package
Run $ORACLE_HOME/rdbms/admin/profload.sql in the APPSschema
Create the run-time PL/SQL profiler tables
Run $ORACLE_HOME/rdbms/admin/proftab.sql in the schema
running the application, in our case APPSProfiler Tables
PLSQL_PROFILER_RUNS
PLSQL_PROFILER_UNITS
PLSQL_PROFILER_DATA
-
7/27/2019 Diagnostic Tools and Traces
32/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 32
PL/SQL Profiler - Running it
Execute dbms_profiler.start_profiler();
Starts profiler data collection in session
Execute PL/SQL code to be profiled
Execute dbms_profiler.stop_profiler;
Flushes data into profiler tables and stops profiler data collection
Exiting session does not save data automatically
Profiler data is stored in memory. You can calldbms_profiler.flush_data at various points in your code saveincremental data and free memory, if you expect a lot of data to be
generated
-
7/27/2019 Diagnostic Tools and Traces
33/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 33
PL/SQL ProfilerQuerying Profiler Data
Script available $ORACLE_HOME/plsql/demo
profsum.sqlGives a summary of all the plsql units called in the run
You can also refer to a script available on Metalink. Refer toNote 243755.1 for details.
-
7/27/2019 Diagnostic Tools and Traces
34/50
-
7/27/2019 Diagnostic Tools and Traces
35/50
-
7/27/2019 Diagnostic Tools and Traces
36/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 36
PLSQL Profiler - Forms
-
7/27/2019 Diagnostic Tools and Traces
37/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 37
PLSQL Profiler - Forms
Help-> Diagnostics -> Trace -> PL/SQL profiler
Click checkbox to Enable
Perform the action
When done, click checkbox to disable.
Exit from the application
You will get a message that a concurrent report has beensubmitted.
Login back again and view the output for this concurrentrequest.
Output is a hyperlinked profiler report will summary anddetail sections.
-
7/27/2019 Diagnostic Tools and Traces
38/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 38
PLSQL Profiler OA FWK
-
7/27/2019 Diagnostic Tools and Traces
39/50
-
7/27/2019 Diagnostic Tools and Traces
40/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 40
FORMS RUNTIMEDIAGNOSTICS
-
7/27/2019 Diagnostic Tools and Traces
41/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 41
Forms Runtime Diagnostics
Forms Runtime Diagnostics (FRD) is a runtime event-based logging system intended to aid in the debugging ofForms applications
FRD is enabled at runtime on a user by user basis
Trace file contains chronological representation of externaluser events and internal Forms processing events
FRD generates extensive output useful for analysis and
debugging, and it is therefore recommended FRD beutilized as a logging mechanism only when specific issuesare encountered.
-
7/27/2019 Diagnostic Tools and Traces
42/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 42
Forms Runtime Diagnostics
Events traced by FRD
NavigationTrigger Firing: includes name and location
Built-in execution (includes name and IN and OUT parameter typesand values)
All external user eventsMessages
FMX/MMX file opens
Unhandled exceptions
-
7/27/2019 Diagnostic Tools and Traces
43/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 43
Forms Runtime Diagnostics
Logon to Applications 11i with the following text appended
to the URL: play=&record=all&log=/tmp/form1.trc Reproduce the steps that you wish to trace in Applications
Exit from the Application completely
Retrieve the trace file from the application serverAnalyze the trace file
In case you log into Apps through PHP, you need to set youruser level profile ICX:Forms Launcher. The value you needto set this to is the string mentioned above appended to thevalue of this profile option at the Site level.
-
7/27/2019 Diagnostic Tools and Traces
44/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 44
REPORTS TRACE
-
7/27/2019 Diagnostic Tools and Traces
45/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 45
Reports Trace
Enabled by appending tracing parameters to command line
ar60run TRACEFILE= TRACE_OPTS=()TRACEMODE=trace_replace|trace_append
Where trace options can be one or more of the following :
TRACE_ALL : log all possible trace information in the trace file. (DEFAULT)TRACE_APP : log trace information on all the report objects in the trace file.
TRACE_BRK : list breakpoints in the trace file.
TRACE_ERR : list error messages and warnings in the trace file.
TRACE_PLS : log trace information on all the PL/SQL objects in the trace file.
TRACE_PRF : log performance statistics in the trace file.
TRACE_SQL : log trace information on all the SQL in the trace file.
TRACE_TMS : enter a timestamp for each entry in the trace file.
-
7/27/2019 Diagnostic Tools and Traces
46/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 46
Reports Trace
Sign-on to Apps with System Administrator responsibility
Go to Concurrent -> Program -> Define
Query up your Reports concurrent program
Locate the Options field and enter the following values :
TRACEOPTS= TRACEFILE=
Save the concurrent program
Running the concurrent program now will generate thereports trace file as specified by TRACEFILE
Caution : Since this involves changes at the reportdefinition level, this operation should be performed on thetest instance when no other user is running this report.
-
7/27/2019 Diagnostic Tools and Traces
47/50
2006-2007 dbPerf Inc. All rights reserved. Cisco ConfidentialPresentation_ID 47
Reports TraceLOG :
Report: /u01/CRMPERF/appl/fnd/11.5.0/reports/US/FNDSCURS.rdf
Logged onto server:
Username:
. . . . . . . .
23:59:57 APP ... ( Generic Graphical Object B_SECURITY_GROUP_NAME1
23:59:57 APP ... ) Generic Graphical Object B_SECURITY_GROUP_NAME1
23:59:57 APP ... ( Generic Graphical Object B_USER_NAME1
. . . . . . . .
+-------------------------------------+
| Report Builder Profiler statistics |
+-------------------------------------+
TOTAL ELAPSED Time: 2243.04 seconds
Reports Time: 1196.62 seconds (53.34% of TOTAL)
ORACLE Time: 1046.41 seconds (46.65% of TOTAL)
UPI: 1046.00 seconds
SQL: 0.40 seconds
TOTAL CPU Time used by process: 904.71 seconds
-
7/27/2019 Diagnostic Tools and Traces
48/50
-
7/27/2019 Diagnostic Tools and Traces
49/50
-
7/27/2019 Diagnostic Tools and Traces
50/50