Installing dtrace on Oracle Enterprise Linux 6.6

Long ago I heard about dtrace. I’ve read some stuff about it here and there but I didn’t get it that much and my attention span is a bit short. But apparently is is a magical performance tool that was available on Solaris, but now on Linux too. Hurray!

Then I was at the UKOUG Tech 2014 conference at Phil Harman’s session and I finally got to see what dtrace was and what you can do with it. Phil showed some interesting uses of dtrace. And I definitely wanted to play with it. But first I needed a setup.

I’ve been meaning to install it on a VirtualBox with Oracle Enterprise Linux with an Oracle 12c database to play with it. In my first attempt (with OEL7) I couldn’t get the Oracle 12c install running. So then I tried a OEL6.6 setup and Oracle 12c, but … I don’t know what I did wrong exactly, but I never found the dtrace executable. Then for a while I didn’t have time for dtrace (or I set my priorities differently).

But I’ve finally got it working. Classic case of RTFM. The F manual to read is Installing and Configuring dtrace. This is how I did it:

  • Setup a VirtualBox with OEL. I’ve used OEL 6.6 64 bits for my tests. This setup also has Unbreakable Enterprise Kernel Release 3.
  • I’ve installed all updates.
  • I’ve setup Oracle ULN registration. (You need a Oracle Support CSI number for that. Luckily we use OEL at work. It’s possible to do this without Oracle ULN probably, but I’m working on a demo for work. So this seemed appropriate)
  • I’ve done the Oracle 11g preinstall thing. (I’ve chosen to install Oracle 11g and create a database for the demo I’m planning to do)

To do it the way I did you, need a ULN account and login with that on linux.oracle.com. Go to the name of your system. You’ll find a table of Subscribed channels and at the right hand a button “Manage Subscriptions”. So what we’re doing here is telling the repository what kind of stuff you are allowed to install with yum.

ULN_dtrace

You need to add “Oracle Linux 6 Dtrace Userspace Tools (x86_64) – Latest”. Be very careful that you choose the right channel, because there are other channels with “dtrace” in the name and these are not the right ones. I’m suspecting this is what I’ve done wrong the previous time.

Now I’ve never been a very good manual reader myself. For some reason I’ve skipped ahead and ran this:

yum install dtrace-modules-`uname -r`

Which might be the reason for the errors I got when I tried to install the actual dtrace stuff:

Running Transaction Test


Transaction Check Error:
package kernel-uek-firmware-3.8.13-44.1.1.el6uek.noarch (which is newer than kernel-uek-firmware-3.8.13-16.el6uek.noarch) is already installed
package kernel-uek-firmware-3.8.13-68.2.2.el6uek.noarch (which is newer than kernel-uek-firmware-3.8.13-16.el6uek.noarch) is already installed

I tried if I could downgrade this package and it said you can have multiple versions of it. So I installed the older version it needed.

[root@sequoia ~]# yum install kernel-uek-firmware-3.8.13-16.el6uek.noarch
Loaded plugins: refresh-packagekit, rhnplugin, security
This system is receiving updates from ULN.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-uek-firmware.noarch 0:3.8.13-16.el6uek will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
Package                               Arch                     Version                               Repository                                 Size
======================================================================================================================================================
Installing:
kernel-uek-firmware                   noarch                   3.8.13-16.el6uek                      ol6_x86_64_UEKR3_latest                   1.6 M

Transaction Summary
======================================================================================================================================================
Install       1 Package(s)

Total size: 1.6 M
Installed size: 2.8 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-uek-firmware-3.8.13-16.el6uek.noarch                                                                                        1/1
Verifying  : kernel-uek-firmware-3.8.13-16.el6uek.noarch                                                                                        1/1

Installed:
kernel-uek-firmware.noarch 0:3.8.13-16.el6uek

Complete!

Now the installation of dtrace worked:

[root@sequoia ~]# yum install dtrace-utils
Loaded plugins: refresh-packagekit, rhnplugin, security
This system is receiving updates from ULN.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dtrace-utils.x86_64 0:0.4.5-2.el6 will be installed
--> Processing Dependency: dtrace-modules-headers for package: dtrace-utils-0.4.5-2.el6.x86_64
--> Running transaction check
---> Package dtrace-modules-3.8.13-16.el6uek-headers.x86_64 0:0.4.0-3.el6 will be installed
--> Processing Dependency: dtrace-modules-3.8.13-16.el6uek for package: dtrace-modules-3.8.13-16.el6uek-headers-0.4.0-3.el6.x86_64
--> Running transaction check
---> Package dtrace-modules-3.8.13-16.el6uek.x86_64 0:0.4.0-3.el6 will be installed
--> Processing Dependency: kernel-uek = 3.8.13-16.el6uek for package: dtrace-modules-3.8.13-16.el6uek-0.4.0-3.el6.x86_64
--> Running transaction check
---> Package kernel-uek-debug.x86_64 0:3.8.13-16.el6uek will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
Package                                            Arch              Version                     Repository                                     Size
======================================================================================================================================================
Installing:
dtrace-utils                                       x86_64            0.4.5-2.el6                 ol6_x86_64_Dtrace_userspace_latest            268 k
Installing for dependencies:
dtrace-modules-3.8.13-16.el6uek                    x86_64            0.4.0-3.el6                 ol6_x86_64_UEKR3_latest                       1.1 M
dtrace-modules-3.8.13-16.el6uek-headers            x86_64            0.4.0-3.el6                 ol6_x86_64_UEKR3_latest                        27 k
kernel-uek-debug                                   x86_64            3.8.13-16.el6uek            ol6_x86_64_UEKR3_latest                        39 M

Transaction Summary
======================================================================================================================================================
Install       4 Package(s)

Total size: 40 M
Installed size: 177 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-uek-debug-3.8.13-16.el6uek.x86_64                                                                                           1/4
Installing : dtrace-modules-3.8.13-16.el6uek-0.4.0-3.el6.x86_64                                                                                 2/4
Installing : dtrace-modules-3.8.13-16.el6uek-headers-0.4.0-3.el6.x86_64                                                                         3/4
Installing : dtrace-utils-0.4.5-2.el6.x86_64                                                                                                    4/4
Verifying  : dtrace-utils-0.4.5-2.el6.x86_64                                                                                                    1/4
Verifying  : kernel-uek-debug-3.8.13-16.el6uek.x86_64                                                                                           2/4
Verifying  : dtrace-modules-3.8.13-16.el6uek-headers-0.4.0-3.el6.x86_64                                                                         3/4
Verifying  : dtrace-modules-3.8.13-16.el6uek-0.4.0-3.el6.x86_64                                                                                 4/4

Installed:
dtrace-utils.x86_64 0:0.4.5-2.el6

Dependency Installed:
dtrace-modules-3.8.13-16.el6uek.x86_64 0:0.4.0-3.el6                  dtrace-modules-3.8.13-16.el6uek-headers.x86_64 0:0.4.0-3.el6
kernel-uek-debug.x86_64 0:3.8.13-16.el6uek

Complete!

So.. now the proof of the pudding. Can I use the dtrace executable?

[root@sequoia ~]# dtrace
Usage: dtrace [-32|-64] [-aACeFGhHlqSvVwZ] [-b bufsz] [-c cmd] [-D name[=def]]
[-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
[-x opt[=val]] [-X a|c|s|t]

[-P provider [[ predicate ] action ]]
[-m [ provider: ] module [[ predicate ] action ]]
[-f [[ provider: ] module: ] func [[ predicate ] action ]]
[-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]]
[-i probe-id [[ predicate ] action ]] [ args ... ]

predicate -> '/' D-expression '/'
action -> '{' D-statements '}'

-32 generate 32-bit D programs and ELF files
-64 generate 64-bit D programs and ELF files

-a  claim anonymous tracing state
-A  generate driver.conf(4) directives for anonymous tracing
-b  set trace buffer size
-c  run specified command and exit upon its completion
-C  run cpp(1) preprocessor on script files
-D  define symbol when invoking preprocessor
-e  exit after compiling request but prior to enabling probes
-f  enable or list probes matching the specified function name
-F  coalesce trace output by function
-G  generate an ELF file containing embedded dtrace program
-h  generate a header file with definitions for static probes
-H  print included files when invoking preprocessor
-i  enable or list probes matching the specified probe id
-I  add include directory to preprocessor search path
-l  list probes matching specified criteria
-L  add library directory to library search path
-m  enable or list probes matching the specified module name
-n  enable or list probes matching the specified probe name
-o  set output file
-p  grab specified process-ID and cache its symbol tables
-P  enable or list probes matching the specified provider name
-q  set quiet mode (only output explicitly traced data)
-s  enable or list probes according to the specified D script
-S  print D compiler intermediate code
-U  undefine symbol when invoking preprocessor
-v  set verbose mode (report stability attributes, arguments)
-V  report DTrace API version
-w  permit destructive actions
-x  enable or modify compiler and tracing options
-X  specify ISO C conformance settings for preprocessor
-Z  permit probe descriptions that match zero probes

Yay!

And it was immediately followed by this warning:

Linux_kernel_update_na_dtrace_install

So I ran the upgrade and tried the dtrace executable again. Still worked. Okay. Now I wanted to do one simple statement I’ve written down during the session of Phil Harman, but that didn’t work.

[root@sequoia ~]# dtrace -n 'syscall::write:entry {@[execname] = count();}'
dtrace: invalid probe specifier syscall::write:entry {@[execname] = count();}: probe description syscall::write:entry does not match any probes

Yeah… Isn’t this how it always goes? Getting from one error to the next one. I clearly need to so something much simpler. First let’s read TF manual again. I’ll get back to you.

 

 

 

Advertisements

About Marcel-Jan Krijgsman

Ever since I started working with Oracle, I had an interest in Oracle database performance tuning. This led, eventually, to a four day training I made and gave for customers of Transfer Solutions. Since 2012 I work for Rabobank Nederland. A few years ago I also became interested in Oracle database security. All technology aside, it is my experience that security usually plays out on a political level. I'm a Oracle certified professional for the 8i, 9i, 10g and 11g databases and Oracle Database 11g Performance Tuning Certified Expert.
This entry was posted in Linux and tagged , , , , . Bookmark the permalink.

2 Responses to Installing dtrace on Oracle Enterprise Linux 6.6

  1. Pingback: Fun with Dtrace: files Oracle opens on database startup | Marcel-Jan's Oracle Blog

  2. Rich Larrabee says:

    Thanks for the article Marcel. I ran into the same issue and your article certainly helped.

    Rich

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s