百度空间 | 百度首页 
               
 
查看文章
 
SQL Trace与TKPROF工具
2008/12/14 11:27
1、初始化参数
1)STATISTICS_LEVEL(Dynamic: ALTER SESSION, ALTER SYSTEM)
BASIC: No advisories or statistics are collected.
TYPICAL: The following advisories or statistics are collected:
Buffer cache advisory
MTTR advisory
Shared Pool sizing advisory
Segment level statistics
PGA target advisory
Timed statistics
ALL: All of the preceding advisories or statistics are collected, plus the following:
Timed operating system statistics
Row source execution statistics
2)TIMED_STATISTICS(Dynamic: ALTER SESSION, ALTER SYSTEM)
如果STATISTICS_LEVEL设置为basic,要收集统计信息,TIMED_STATISTICS必须设为true
3)SQL_TRACE(Static,alter session)
2、打开sql trace
alter session set sql_trace=true;
将在udump目录下生成trace文件
3、将trace文件格式化成报告
$ tkprof orasafe_ora_24082.trc out.rpt sort=prscpu
4、报告注解
PARSE :Translates the SQL statement into an execution plan, including checks for proper security authorization and checks for the existence of tables, columns, and other referenced objects.
EXECUTE: Actual execution of the statement by Oracle. For INSERT,UPDATE, and DELETE statements, this modifies the data. For SELECT statements, this identifies the selected rows.
FETCH: Retrieves rows returned by a query. Fetches are only performed for SELECT statements.
COUNT: Number of times a statement was parsed, executed, or fetched.
CPU: Total CPU time in seconds for all parse, execute, or fetch calls for the statement. This value is zero (0) if TIMED_STATISTICS is not turned on.
ELAPSED: Total elapsed time in seconds for all parse, execute, or fetch calls for the statement. This value is zero (0) if TIMED_STATISTICS is not turned on.
DISK: Total number of data blocks physically read from the datafiles on disk for all parse, execute, or fetch calls.
QUERY: Total number of buffers retrieved in consistent mode for all parse, execute, or fetch calls. Usually, buffers are retrieved in consistent mode for queries.
CURRENT: Total number of buffers retrieved in current mode. Buffers are retrieved in current mode for statements such as INSERT,UPDATE, and DELETE.
ROWS: Total number of rows processed by the SQL statement. This total does not include rows processed by subqueries of the SQL statement.

类别:Oracle | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu