- 浏览: 309408 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (118)
- oracle (16)
- java (13)
- jquery (16)
- hibernate (2)
- spring (14)
- struts (2)
- eclipse (1)
- birt (5)
- integrated skill (13)
- linux (9)
- css+html (5)
- redis (1)
- jqgrid (4)
- mybatis (2)
- multithreading (3)
- jvm (1)
- mvn (3)
- php (2)
- jms (2)
- photoshop (1)
- springmvc (3)
- cluster (1)
- cache (1)
- jquery-ui (2)
- 英语词根 (0)
- svn (0)
- ide (1)
- mysql (3)
- rich-text (1)
- golang (8)
- mac 10 (1)
- android (1)
- react (0)
- bootstrap (2)
- css (2)
- 1 (0)
- beego (1)
- pictures (1)
- java小生转战 (0)
- 转站通知 (0)
- 转站通知,,,啊啊啊 (1)
- threeperson (1)
- unity (1)
最新评论
-
zld406504302:
aaaddddddd
java小生转站threeperson博客 -
zld406504302:
aaaaaddd
java小生转站threeperson博客 -
zld406504302:
aaaaaaaaaaaa
java小生转站threeperson博客 -
乌发舞天:
UEditor 实例 -
van_2013:
请问这是订阅模式的配置吗?
SPRING JMS 整合ACTIVEMQ
oracle tkprof 分析sql执行计划
1)开启系统级sql追踪
alter system set sql_trace= true ;
select b.spid,a.sid,a.serial#,a.machine from v$session a,v$process b where a.paddr = b.addr and a.machine='yangyang(计算机名)';
----http://www.iteye.com/topic/19024 (部分引用)
SQL> select b.spid,a.sid,a.serial#,a.machine from v$session a,v$process b where a.paddr = b.addr and a.machine='yangyang';
SPID SID SERIAL#
------------ ---------- ----------
MACHINE
----------------------------------------------------------------
4007 5487 4
yangyang
4009 5483 1
yangyang
4013 5482 2
yangyang
SQL> execute sys.dbms_system.set_ev(49, 3406,10046,1,'');
SQL> execute sys.dbms_system.set_ev(5487,4,10046,1,'');
PL/SQL procedure successfully completed.
SQL> execute sys.dbms_system.set_ev(5487,4,10046,0,'');
获取本机
2) 访问数据库后,要关闭追踪
alter system set sql_trace= false ;
3)获得追踪计划保存的文件
SELECT d.VALUE
|| '/'
|| LOWER (RTRIM (i.INSTANCE, CHR (0)))
|| '_ora_'
|| p.spid
|| '.trc' trace_file_name
FROM (SELECT p.spid
FROM v$mystat m, v$session s, v$process p
WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,
(SELECT t.INSTANCE
FROM v$thread t, v$parameter v
WHERE v.NAME = 'thread'
AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,
(SELECT VALUE
FROM v$parameter
WHERE NAME = 'user_dump_dest') d
可以制作成sql文件放在linux系统下 例如保存为 trace_sql.sql
@/home/netmessage/trace_sql.sql
SQL> @/home/netmessage/trace_sql.sql
17 ;
TRACE_FILE_NAME
--------------------------------------------------------------------------------
/opt/oracle/admin/orcl/udump/orcl_ora_11822.trc
4)分析追踪计划 用tkprof (linux 下tkprof 报错,所以在xp下进行分析了一下,linux 找到tkprof 所在的bin 就可以了,应该是8i 以上 在oracle bin中有存在)
C:\Documents and Settings\Administrator>tkprof d:\sql.trc d:\sql.txt
看一下执行计划的分析结果:
TKPROF: Release 10.2.0.1.0 - Production on 星期一 3月 26 18:39:22 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: d:\sql.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 system set sql_trace=true
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.06 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 1 0.00 0.06 0 0 0 0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
********************************************************************************
SELECT PT.VALUE
FROM
SYS.V_$SESSTAT PT WHERE PT.SID=:1 AND PT.STATISTIC# IN (7,47,50,54,134,335,
336,337,341,342) ORDER BY PT.STATISTIC#
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 0 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: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
********************************************************************************
select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$, spare1,
spare2
from
obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null
and linkname is null and subname is null
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 4 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.00 0.00 0 4 0 1
Misses in library cache during parse: 0
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=4 pr=0 pw=0 time=71 us)
1 INDEX RANGE SCAN I_OBJ2 (cr=3 pr=0 pw=0 time=50 us)(object id 37)
********************************************************************************
select cols,audit$,textlength,intcols,property,flags,rowid
from
view$ where obj#=:1
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 3 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.00 0.00 0 3 0 1
Misses in library cache during parse: 0
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
********************************************************************************
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.06 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.06 0 0 0 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 0 7 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 6 0.00 0.00 0 7 0 2
Misses in library cache during parse: 0
2 user SQL statements in session.
2 internal SQL statements in session.
4 SQL statements in session.
********************************************************************************
Trace file: d:\sql.trc
Trace file compatibility: 10.01.00
Sort options: default
2 sessions in tracefile.
3 user SQL statements in trace file.
2 internal SQL statements in trace file.
4 SQL statements in trace file.
4 unique SQL statements in trace file.
45 lines in trace file.
82 elapsed seconds in trace file.
发表评论
-
java 调用oracle 管道表函数
2013-07-10 22:11 2041需求:用户导入100万白名单 ... -
sql实现多行数据比对更新或插入操作
2013-05-29 14:41 4914Merge语法 MERGE [hint] INTO [sche ... -
oracle conn /as sysdba 找不到实例
2013-03-07 11:47 979oracle conn /as sysdba 找不到实例 ... -
oracle 维护、监控、优化常用sql
2013-03-06 09:46 8791) sql监控 SELECT SE.sid, schema ... -
oracle 编码修改
2013-03-05 15:40 671SQL> shutdown immediate; ... -
oracle10 用户无法连接到指定实例
2013-03-05 14:32 1272问题1:tns:could‘not find the iden ... -
oracle10 千万级数据存取优化
2013-02-27 21:34 6214[list] 今天对一个存有1000万数据的大表进 ... -
oracle sql 转义
2012-07-26 18:15 2338今天要在字段里查找'%',涉及到oracle的转义 ... -
获得每个班的前两名学生
2012-06-27 12:33 947群里有个朋友问了一个是sql查询的问题:“获得每个班的两名学 ... -
oracle procdure loop 内异常后继续下一次循环
2012-05-21 22:35 22361)oracle procdure 内异常处理 ... -
java调用 数组作为参数的管道表函数
2012-05-03 17:29 495需求:用户导入100万白 ... -
oracle sql执行计划autotrace 安装
2012-03-23 14:25 915小生对or ... -
oracle 管道表函数2
2012-01-06 15:47 1018由于上一篇关于管道表函数写的有些粗糙,追 ... -
oracle 管道表函数
2011-05-24 17:24 1085------创建一个类型 create or r ... -
oracle 函数返回一个集合
2011-01-10 23:23 1014create or repla ... -
oracle 存储过程
2011-01-06 11:20 842create or replace procedure ...
相关推荐
资源名称:Oracle高性能SQL调整内容简介:本书由Oracle公司授权,向读者详尽阐述如何调整SQL语句、查看内部执行计划和更改执行计划以提高语句性能。主要内容包括:理解SQL调整在Oracle总体微调中地地位,使用诸如...
使用语如内嵌视图和BIF扩展提高QraleSQL性能,确定并报告程序库缓存中的SQL语句,调整SQL表访问、完整表扫描和平行查询,运行TKPROF获得SQL跟踪报告,使用Oracle线索为OracleSQL语句更改执行计划,使用Oracle8i优化...
EXPLAIN PLAN 是一种分析执行计划的工具,可以帮助开发者了解 SQL 语句的执行计划和成本。SQL_TRACE 是一种追踪 SQL 语句执行的工具,可以帮助开发者了解 SQL 语句的执行时间和资源消耗。TKPROF 是一种格式化 SQL_...
理解SQL调整在Oracle总体微调中地地位,使用诸如内嵌视图和BIF扩展提高Oracle SQL性能,确定并报告程式库缓存中的SQL语句,调整SQL表访问、完整表扫描和平行查询,运行TKPROF获得SQL跟踪报告,使用Oracle线索 ...
Tkprof 是一个用于分析Oracle 跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个 系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof 工具使用排序功能格式 化输出,从而...
6.sql trace分析工具--TKPROF详细讲解 7.V$SQL视图详解加几个实例 8.autotrace验证压缩表性能 9.autotrace验证消除子查询后的性能 10.基于基本的优化CBO 11.如何统计数据库数据 12.Oracle如何统计操作系统数据 13./*...
理解SQL调整在Oracle总体微调中地地位,使用诸如内嵌视图和BIF扩展提高Oracle SQL性能,确定并报告程式库缓存中的SQL语句,调整SQL表访问、完整表扫描和平行查询,运行TKPROF获得SQL跟踪报告,使用Oracle线索 ...
SQL Trace and TKPROF
kprof是一个用于分析Oracle跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof工具使用排序功能格式化输出,从而找出有...
Profiler是ORACLE PL/SQL 的一个调试优化跟踪方案的应, 相对sqltrace+tkprof工具调试优化跟踪方案来说, Profiler有最直观更方便的优点,因为不需要生成和读取服务器端的跟踪文件,它是将跟踪数据全部存储的数据库...
1.如何分析SQL语句 2.选用适合的ORACLE优化器 3.用EXPLAIN PLAN 分析SQL语句 4.使用TKPROF 工具来查询SQL性能状态 5.表分区的应用
5.2 sql的执行计划 94 第6章 hint 109 6.1 和优化器相关的hint 115 6.1.1 all_rows和first_rows(cbo) 115 6.1.2 rule hint 117 6.2 访问路径相关的hint 117 6.2.1 full hint 118 6.2.2 index hint 118 6.2.3 no_...
5.2 sql的执行计划 94 第6章 hint 109 6.1 和优化器相关的hint 115 6.1.1 all_rows和first_rows(cbo) 115 6.1.2 rule hint 117 6.2 访问路径相关的hint 117 6.2.1 full hint 118 6.2.2 index hint 118 6.2.3 no_...
详解tkprof转换后的文件格式,用于SQL语句的分析和性能调优
sqlmonitor 1. 找出sid和serial# select sid,serial#,osuser from v$session t where t.USERNAME='USERNAME' 2. 开始sqltrace ... execute dbms_system.set_... 例: tkprof sqltrace文件.trc a.out 8. 打开a.out
• 使用解释计划工具或 tkprof 工具优化你的 SQL 语句。 • 使用 SQL*Plus 或其他工具在你的数据库中查看或修改其他对象和数据。 这些任务——编辑、编译、纠正、测试、调试、优化和查询——都可以在不离开 PL/...
§12.4.1 对所有SQL语句执行EXPLAIN_PLAN 145 §12.4.2 磁盘读和缓冲区获取 146 §12.4.3 判定式崩溃 146 §12.5 使用EXISTS和IN 148 §12.6 分离事务(Discrete Transactions ) 149 §12.7 测试SQL语句性能 151 §...
• 使用解释计划工具或 tkprof 工具优化你的 SQL 语句。 • 使用 SQL*Plus 或其他工具在你的数据库中查看或修改其他对象和数据。这些任务——编辑、编译、纠正、测试、调试、优化和查询——都可以在不离开 PL/SQL ...
使用解释计划工具或 tkprof 工具优化你的 SQL 语句。 使用 SQL*Plus 或其他工具在你的数据库中查看或修改其他对象和数据。 这些任务——编辑、编译、纠正、测试、调试、优化和查询——都可以在不离开 PL/SQL ...
1. 介绍 PL/SQL Developer 是一个为 Oracle 数据库开发存储程序单元的集成开发环境...• 使用解释计划工具或 tkprof 工具优化你的 SQL 语句。 • 使用 SQL*Plus 或另外的工具在你的数据库里查看或修改其它对象和数据