Tkprof Log

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 7

SQL> sho parameter dump

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/oracle/diag/rdbms/orp
t/orpt/trace

ALTER SESSION SET tracefile_identifier=SVS;

Session altered.

ALTER SESSION SET SQL_TRACE=TRUE;

Session altered.

SELECT s.sql_trace, s.sql_trace_waits, s.sql_trace_binds,


traceid, tracefile
FROM v$session s JOIN v$process p ON (p.addr = s.paddr)
WHERE audsid = USERENV ('SESSIONID');

ALTER SESSION SET SQL_TRACE=false;

SELECT SID, SERIAL#, USERNAME FROM V$SESSION where username='SCOTT';

EXECUTE DBMS_MONITOR.SESSION_TRACE_ENABLE(session_id => 38, serial_num =>


1737,waits => TRUE, binds => FALSE);

EXECUTE DBMS_MONITOR.SESSION_TRACE_DISABLE(session_id => 38, serial_num => 1737);

$ cd /u01/app/oracle/admin/DEV/udump/

$ tkprof orpt_ora_25608_SVS01.trc /home/oracle/translated.txt


explain=system/oracle table=sys.plan_table sys=no waits=yes

TKPROF: Release 10.1.0.3.0 - Production on Tue Apr 5 09:22:43 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

$
The contents of the translated file are displayed below.

TKPROF: Release 10.1.0.3.0 - Production on Tue Apr 5 09:53:50 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Trace file: dev1_ora_367660.trc


Sort options: default

********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************

ALTER SESSION SET EVENTS '10046 trace name context forever, level 8'

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 1 0.00 0.00 0 0 0 0

Misses in library cache during parse: 0


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST)

Elapsed times include waiting on following events:


Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 7.35 7.35
********************************************************************************

BEGIN DBMS_OUTPUT.ENABLE(2000); END;

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 1

Misses in library cache during parse: 0


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST)

Elapsed times include waiting on following events:


Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 6.92 6.92
********************************************************************************

BEGIN populate_sql_trace_test(p_loops => 5); END;

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 1

Misses in library cache during parse: 1


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST)

Elapsed times include waiting on following events:


Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
********************************************************************************

INSERT INTO SQL_TRACE_TEST (ID, DESCRIPTION)


VALUES
(:B1 , 'Description for ' || :B1 )

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 5 0.00 0.00 0 1 25 5
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 6 0.00 0.00 0 1 25 5

Misses in library cache during parse: 1


Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST) (recursive depth: 1)

Rows Execution Plan


------- ---------------------------------------------------
0 INSERT STATEMENT MODE: ALL_ROWS

********************************************************************************

SELECT COUNT(*)
FROM
SQL_TRACE_TEST

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 7 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.00 0.00 0 7 0 1

Misses in library cache during parse: 1


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST) (recursive depth: 1)

Rows Execution Plan


------- ---------------------------------------------------
0 SELECT STATEMENT MODE: ALL_ROWS
0 SORT (AGGREGATE)
0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'SQL_TRACE_TEST'
(TABLE)

********************************************************************************

COMMIT

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 1 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 1 0

Misses in library cache during parse: 0


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST) (recursive depth: 1)
********************************************************************************

BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 1

Misses in library cache during parse: 0


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST)

Elapsed times include waiting on following events:


Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 8.56 8.56
********************************************************************************

ALTER SESSION SET EVENTS '10046 trace name context off'

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 0

Misses in library cache during parse: 0


Optimizer mode: ALL_ROWS
Parsing user id: 180 (TEST)
********************************************************************************

OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 4 0.00 0.00 0 0 0 0
Execute 5 0.00 0.00 0 0 0 3
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 9 0.00 0.00 0 0 0 3

Misses in library cache during parse: 1

Elapsed times include waiting on following events:


Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 4 0.00 0.00
SQL*Net message from client 4 8.56 22.84

OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 10 0.05 0.05 0 0 0 0
Execute 18 0.03 0.03 0 1 26 5
Fetch 12 0.00 0.00 0 35 0 9
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 40 0.08 0.08 0 36 26 14

Misses in library cache during parse: 7


Misses in library cache during execute: 6

8 user SQL statements in session.


7 internal SQL statements in session.
15 SQL statements in session.
2 statements EXPLAINed in this session.
********************************************************************************
Trace file: dev1_ora_367660.trc
Trace file compatibility: 10.01.00
Sort options: default

1 session in tracefile.
8 user SQL statements in trace file.
7 internal SQL statements in trace file.
15 SQL statements in trace file.
15 unique SQL statements in trace file.
2 SQL statements EXPLAINed using schema:
sys.plan_table
Schema was specified.
Existing table was used.
146 lines in trace file.
22 elapsed seconds in trace file.
For each statement executed by the session, the file contains a record of the
parse, execute and fetch statistics, an execution plan where necessary and a list
of session waits.

===================================================================================
==========================================
Example:2

This example uses SQL Trace and the TKPROF utility to find parse information. You
log in to the database with administrator privileges, and then query the directory
location of the trace files (sample output included):

SET LINESIZE 120


COLUMN value FORMAT A80

SELECT value
FROM v$diag_info
WHERE name = 'Default Trace File';

VALUE
--------------------------------------------------------------------------------
/disk1/oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_23054.trc
You enable tracing, use the TRACEFILE_IDENTIFIER initialization parameter to give
the trace file a meaningful name, and then query hr.employees:

EXEC DBMS_MONITOR.SESSION_TRACE_ENABLE(waits=>TRUE, binds=>TRUE);


ALTER SESSION SET TRACEFILE_IDENTIFIER = "emp_stmt";
SELECT * FROM hr.employees;
EXIT;
Search the default trace file directory for the trace file that you generated:

% ls *emp_stmt.trc
orcl_ora_17950_emp_stmt.trc
Use TKPROF to format the trace file, and then open the formatted file:

% tkprof orcl_ora_17950_emp_stmt.trc emp.out; vi emp.out


The formatted trace file contains the parse information for the query of
hr.employees.

SQL ID: brmjpfs7dcnub Plan Hash: 1445457117

SELECT *
FROM
hr.employees

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.07 0.08 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 9 0.00 0.00 3 12 0 107
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 11 0.07 0.08 3 12 0 107

Misses in library cache during parse: 1


Optimizer mode: ALL_ROWS
Parsing user id: SYSTEM
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max) Row Source Operation


---------- ---------- ----------
---------------------------------------------------
107 107 107 TABLE ACCESS FULL EMPLOYEES (cr=12 pr=3 pw=0
time=497
us starts=1 cost=2 size=7383 card=107)
A library cache miss indicates a hard parse. Performing the same steps for a second
execution of the same statement produces the following trace output, which shows no
library cache misses:

SQL ID: brmjpfs7dcnub Plan Hash: 1445457117

SELECT *
FROM
hr.employees

call count cpu elapsed disk query current rows


------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 9 0.00 0.00 3 12 0 107
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 11 0.00 0.00 3 12 0 107

Misses in library cache during parse: 0


Optimizer mode: ALL_ROWS
Parsing user id: SYSTEM
Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max) Row Source Operation


---------- ---------- ----------
---------------------------------------------------
107 107 107 TABLE ACCESS FULL EMPLOYEES (cr=12 pr=3 pw=0
time=961
us starts=1 cost=2 size=7383 card=107)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy