oracle 如何计算中英文混合字符串占用的字节
2013-10-23 21:12
309 查看
1.生成跟踪文件
alter session set timed_statistics=true;
alter session set events '10046 trace name context forever,level 12';
Session altered.
Session altered.
2.获得跟踪文件名
select rtrim(c.value,'/')||'/'||d.instance_name||'_ora_'||ltrim(to_char(a.spid))||'.trc'
from v$process a,v$session b,v$parameter c,v$instance d
where a.addr=b.paddr
and b.audsid=sys_context('userenv','sessionid')
and c.name='user_dump_dest';
RTRIM(C.VALUE,'/')||'/'||D.INSTANCE_NAME||'_ORA_'||LTRIM(TO_CHAR(A.SPID))||'.TRC
--------------------------------------------------------------------------------
/home/oracle/admin/ora10/udump/ora10_ora_18864.trc
3.创建TKPROF报告
tkprof /home/oracle/admin/ora10/udump/ora10_ora_16424.trc /tmp/t.txt
注意 /home/oracle/admin/ora10/udump/ora10_ora_16424.trc 这个文件只能是
ORACLE 用户才能读出
4.读报告
vi /tmp/t.txt
---运行程序
selectcount(*)
from
t
查询和执行统计
执行次数CPU时间量占用时间磁盘IO查询当前行
call调用countcpuelapseddiskquerycurrentrows
-----------------------------------------------------------------------
Parse分析10.000.000000
Execute执行10.000.000000
Fetch提取20.041.6368970801
-----------------------------------------------------------------------
total合计40.041.6468970801
Missesinlibrarycacheduringparse:1高速缓冲错误1
Optimizermode:ALL_ROWS优化方式
Parsinguserid:54分析用户ID
RowsRowSourceOperation
----------------------------------------------------------
cr为一致方式读取,显示一致读取数(逻辑I/O)pr是物理读取pw为物理写入time=(以百万分之一秒计占用时间)
1SORTAGGREGATE(cr=708pr=689pw=0time=1638784us)
51018TABLEACCESSFULLT(cr=708pr=689pw=0time=765387us)
等候时间
Elapsedtimesincludewaitingonfollowingevents:
EventwaitedonTimesMax.WaitTotalWaited
----------------------------------------Waited----------------------
SQL*Netmessagetoclient20.000.00
dbfilescatteredread510.071.60
SQL*Netmessagefromclient20.000.00
********************************************************************************
alter session set timed_statistics=true;
alter session set events '10046 trace name context forever,level 12';
Session altered.
Session altered.
2.获得跟踪文件名
select rtrim(c.value,'/')||'/'||d.instance_name||'_ora_'||ltrim(to_char(a.spid))||'.trc'
from v$process a,v$session b,v$parameter c,v$instance d
where a.addr=b.paddr
and b.audsid=sys_context('userenv','sessionid')
and c.name='user_dump_dest';
RTRIM(C.VALUE,'/')||'/'||D.INSTANCE_NAME||'_ORA_'||LTRIM(TO_CHAR(A.SPID))||'.TRC
--------------------------------------------------------------------------------
/home/oracle/admin/ora10/udump/ora10_ora_18864.trc
3.创建TKPROF报告
tkprof /home/oracle/admin/ora10/udump/ora10_ora_16424.trc /tmp/t.txt
注意 /home/oracle/admin/ora10/udump/ora10_ora_16424.trc 这个文件只能是
ORACLE 用户才能读出
4.读报告
vi /tmp/t.txt
---运行程序
selectcount(*)
from
t
查询和执行统计
执行次数CPU时间量占用时间磁盘IO查询当前行
call调用countcpuelapseddiskquerycurrentrows
-----------------------------------------------------------------------
Parse分析10.000.000000
Execute执行10.000.000000
Fetch提取20.041.6368970801
-----------------------------------------------------------------------
total合计40.041.6468970801
Missesinlibrarycacheduringparse:1高速缓冲错误1
Optimizermode:ALL_ROWS优化方式
Parsinguserid:54分析用户ID
RowsRowSourceOperation
----------------------------------------------------------
cr为一致方式读取,显示一致读取数(逻辑I/O)pr是物理读取pw为物理写入time=(以百万分之一秒计占用时间)
1SORTAGGREGATE(cr=708pr=689pw=0time=1638784us)
51018TABLEACCESSFULLT(cr=708pr=689pw=0time=765387us)
等候时间
Elapsedtimesincludewaitingonfollowingevents:
EventwaitedonTimesMax.WaitTotalWaited
----------------------------------------Waited----------------------
SQL*Netmessagetoclient20.000.00
dbfilescatteredread510.071.60
SQL*Netmessagefromclient20.000.00
********************************************************************************
相关文章推荐
- javascript_按字节截取、计算中英文混合字符串字节数
- 使用 sql、 javascript 按字节截取、计算中英文混合字符串字节数
- ASP如何计算中英文混合字符串长度和截取字符串 .
- ASP如何计算中英文混合字符串长度和截取字符串
- 计算中英文混合字符串的字节长度
- asp.net中如何计算中英文混合字符串长度
- 计算中英文混合字符串长度,中文算两个字符
- 计算中英文混合字符串的长度
- ASP.NET 中计算中英文混合字符串长度
- iOS计算中英文混合字符串长度的方法
- C#实现 获取指定字节长度 中英文混合字符串 的方法
- 在javascript中如何得到中英文混合字符串的长度
- C#实现 获取指定字节长度 中英文混合字符串 的方法
- 用JavaScript计算字符串占用字节数
- 计算中英文混合字符串的宽度
- 如何正确截取中英文混合的字符串?
- javaSE-基础篇-如何获得中文英文混合字符串的字节长度
- php计算中英文混合或中文字符串的字数
- 计算中英文混合字符串长度
- iOS 计算中英文混合字符串的长度