首页 > 代码库 > 读懂sql_trace

读懂sql_trace

TKPROF: Release 11.2.0.1.0 - Development on 星期一 11月 3 21:39:41 2014Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.Trace file: c:\orcl_ora_4075.trcSort options: default********************************************************************************count    = number of times OCI procedure was executedcpu      = cpu time in seconds executing elapsed  = elapsed time in seconds executingdisk     = number of physical reads of buffers from diskquery    = number of buffers gotten for consistent readcurrent  = number of buffers gotten in current mode (usually for update)rows     = number of rows processed by the fetch or execute call********************************************************************************SQL ID: 4tk6t8tfsfqbfPlan Hash: 0alter session set sql_trace=truecall     count       cpu    elapsed       disk      query    current        rows------- ------  -------- ---------- ---------- ---------- ----------  ----------Parse        0      0.00       0.00          0          0          0           0Execute      1      0.00       0.00          0          0          0           0Fetch        0      0.00       0.00          0          0          0           0------- ------  -------- ---------- ---------- ---------- ----------  ----------total        1      0.00       0.00          0          0          0           0Misses in library cache during parse: 0Misses in library cache during execute: 1Optimizer mode: ALL_ROWSParsing user id: SYS********************************************************************************select t.ename,m.dname from scott.EMP t,scott.dept m where t.deptno=m.deptnoand m.deptno=88call     count       cpu    elapsed       disk      query    current        rows------- ------  -------- ---------- ---------- ---------- ----------  ----------Parse        1      0.00       0.00          0          0          0           0Execute      1      0.00       0.00          0          0          0           0Fetch        7      0.01       0.01          0         84          0          90------- ------  -------- ---------- ---------- ---------- ----------  ----------total        9      0.01       0.01          0         84          0          90Misses in library cache during parse: 0--如果是软分析这里为0 硬分析为1Optimizer mode: ALL_ROWSParsing user id: SYS/*cr=222957          -- 一致性读取数据库的块数  --相当于FETCH query的数目pr=222186          -- 物理读取pw=0               -- 物理写time=100000562 us  -- 占用时间,单位:微妙 百万分之一秒rows		--实际返回的行数*/Rows     Row Source Operation-------  ---------------------------------------------------     90  NESTED LOOPS  (cr=84 pr=0 pw=0 time=0 us cost=4 size=22 card=1)      1   TABLE ACCESS BY INDEX ROWID DEPT (cr=2 pr=0 pw=0 time=0 us cost=1 size=13 card=1)      1    INDEX UNIQUE SCAN PK_DEPT (cr=1 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 73180)     90   TABLE ACCESS FULL EMP (cr=82 pr=0 pw=0 time=0 us cost=3 size=9 card=1)********************************************************************************SQL ID: aam2chsgpj7mbPlan Hash: 0alter session set sql_trace=falsecall     count       cpu    elapsed       disk      query    current        rows------- ------  -------- ---------- ---------- ---------- ----------  ----------Parse        1      0.00       0.00          0          0          0           0Execute      1      0.00       0.00          0          0          0           0Fetch        0      0.00       0.00          0          0          0           0------- ------  -------- ---------- ---------- ---------- ----------  ----------total        2      0.00       0.00          0          0          0           0Misses in library cache during parse: 1Optimizer mode: ALL_ROWSParsing user id: SYS********************************************************************************OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTScall     count       cpu    elapsed       disk      query    current        rows------- ------  -------- ---------- ---------- ---------- ----------  ----------Parse        2      0.00       0.00          0          0          0           0Execute      3      0.00       0.00          0          0          0           0Fetch        7      0.01       0.01          0         84          0          90------- ------  -------- ---------- ---------- ---------- ----------  ----------total       12      0.01       0.02          0         84          0          90Misses in library cache during parse: 1Misses in library cache during execute: 1OVERALL TOTALS FOR ALL RECURSIVE STATEMENTScall     count       cpu    elapsed       disk      query    current        rows------- ------  -------- ---------- ---------- ---------- ----------  ----------Parse        0      0.00       0.00          0          0          0           0Execute      0      0.00       0.00          0          0          0           0Fetch        0      0.00       0.00          0          0          0           0------- ------  -------- ---------- ---------- ---------- ----------  ----------total        0      0.00       0.00          0          0          0           0Misses in library cache during parse: 0    3  user  SQL statements in session.    0  internal SQL statements in session.    3  SQL statements in session.********************************************************************************Trace file: c:\orcl_ora_4075.trcTrace file compatibility: 11.1.0.7Sort options: default       1  session in tracefile.       3  user  SQL statements in trace file.       0  internal SQL statements in trace file.       3  SQL statements in trace file.       3  unique SQL statements in trace file.      57  lines in trace file.      13  elapsed seconds in trace file.

  

读懂sql_trace