DTrace Oracle Database

Posted zengkefu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DTrace Oracle Database相关的知识,希望对你有一定的参考价值。

http://d.hatena.ne.jp/yohei-a/20100515/1273954199

DTrace で Oracle Database のサーバー?プロセスをトレースしてみた技术分享技术分享

2010-03-22 - 未来のいつか/hyoshiokの日記

第102回カーネル読書会 に行ってきて、DTrace を使ってみようと思ってもう 2 ケ月近くすぎた。

やっと使ってみた。

 

sqlplus でログインして、

$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sun May 16 04:59:23 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

DTrace でトレースを開始して、

$ su -
# ps -ef|grep [o]racleorcl
  502   475   474   0   0:00.02 ??         0:00.03 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
# dtrace -p 475 -Fn ‘pid$target:oracle:qer*Fetch*:entry pid$target:oracle:qer*Fetch*:return‘
dtrace: description pid$target:oracle:qer*Fetch*:entry pid$target:oracle:qer*Fetch*:return‘ matched 269 probes

SQL を実行してみると、

SQL> select count(1) from all_users;

  COUNT(1)
----------
	27

SQL> 

お、なんか出た。

# ps -ef|grep [o]racleorcl
  502   475   474   0   0:00.02 ??         0:00.03 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
# dtrace -p 475 -Fn ‘pid$target:oracle:qer*Fetch*:entry pid$target:oracle:qer*Fetch*:return‘
dtrace: description pid$target:oracle:qer*Fetch*:entry pid$target:oracle:qer*Fetch*:return‘ matched 269 probes
CPU FUNCTION                                 
  0  -> qergsFetch                            
  0    -> qerhjFetch                          
  0      -> qerhjFetch                        
  0        -> qertbFetch                      
  0        <- qertbFetch                      
  0        -> qertbFetch                      
  0        <- qertbFetch                      
  0      <- qerhjFetch                        
  0      -> qertbFetch                        
  0      <- qertbFetch                        
  0    <- qerhjFetch                          
  0  <- qergsFetch                      

環境は以下の通り。

# sw_vers
ProductName:	Mac OS X
ProductVersion:	10.6.3
BuildVersion:	10D578
# uname -a
Darwin yoheia-no-macbook 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
# su - oracle
$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sun May 16 05:08:11 2010

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE	10.2.0.4.0	Production
TNS for MacOS X Server: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

以上是关于DTrace Oracle Database的主要内容,如果未能解决你的问题,请参考以下文章

在 Oracle Linux 上使用 DTrace

Oracle Solaris 上的 dtrace java API?

在Oracle Linux上安装dtrace

DTrace Probes in HotSpot VM----java

MySQL 5.6.20-4 and Oracle Linux DTrace

Oracle hidden costs revealed, Part2 – Using DTrace to find why writes in SYSTEM tablespace are slowe