Fun with Dtrace: files Oracle opens on database startup

I’ve got Dtrace working (install story) and the party is started.

You can write your own Dtrace programs in the D language, but there are also a load of Dtrace one-liners. You can find a list of those on the site of Brendan Gregg, who wrote a book on Dtrace, and more recently also a book on Systems Performance. I have that book and I’m reading the chapter in it on Dtrace.

If you want to know more on where Dtrace came from you can see Brendan’s presentation on Tracing Summit 2014 where he tells about Dtrace’s origins, Dtrace on Linux and other performance tools.

I’ve tried some one-liners now. Here is one that I thought would be interesting: with this you can see all files that have been opened.

dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }'

Wouldn’t it be cool to see what files are accessed while starting a database? So I tried that. Predictably there is a lot of output: 3700+ lines. Which I won’t show you here of course. Here are the first lines that appeared as soon as I hit the enter key after typing in “startup” in sqlplus:

dtrace: description 'syscall::open*:entry ' matched 3 probes
CPU     ID    FUNCTION:NAME
0      8       open:entry vminfo /var/run/utmp
0      8       open:entry vminfo /etc/passwd
0      8       open:entry oracle /proc/self/fd/
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileKNUTSEL.ora
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileKNUTSEL.ora
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileKNUTSEL.ora
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/oracore/mesg/lrmus.msb
0      8       open:entry oracle /sys/devices/system/cpu/online
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb
0      8       open:entry oracle /etc/oracle/olr.loc
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/log/knutsel_ora_3396.trc
0      8       open:entry oracle /etc/oracle/ocr.loc
0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/dbs/lkinstKNUTSEL
0      8       open:entry oracle /proc/self/fd/
0      8       open:entry oracle /u01/app/oracle/diag/rdbms/knutsel/KNUTSEL/metadata/ADR_INTERNAL.mif
0      8       open:entry oracle /u01/app/oracle/diag/rdbms/knutsel/KNUTSEL/metadata/ADR_INTERNAL.mif
0      8       open:entry oracle /u01/app/oracle/diag/rdbms/knutsel/KNUTSEL/metadata/ADR_INTERNAL.mif
0      8       open:entry oracle /etc/host.conf
0      8       open:entry oracle /etc/resolv.conf
0      8       open:entry oracle /etc/hosts
0      8       open:entry oracle /u01/app/oracle/diag/rdbms/knutsel/KNUTSEL/alert/log.xml
0      8       open:entry oracle /u01/app/oracle/diag/rdbms/knutsel/KNUTSEL/trace/alert_KNUTSEL.log

So you see Oracle starts reading the spfile immediately of my KNUTSEL instance. It’s opening some message files and already starts writing to a trace file. So what is in that trace file? Well, apparently Oracle can’t find two files: /etc/oracle/olr.loc and /etc/oracle/ocr.loc. Then the lkinstKNUTSEL file is created so Oracle knows the instance is already running when you try to start it a second time.

You can see the memory being allocated:

0      8       open:entry oracle /proc/sys/kernel/shmmax
0      8       open:entry oracle /proc/meminfo
0      8       open:entry oracle /usr/lib64/libnuma.so
0      8       open:entry oracle /dev/shm/ora_KNUTSEL_589837
0      8       open:entry oracle /dev/shm/ora_KNUTSEL_589837
0      8       open:entry oracle /dev/shm/ora_KNUTSEL_589837
0      8       open:entry oracle /proc/self/maps
0      8       open:entry oracle /dev/shm/ora_KNUTSEL_589837

And only halfway you can see the control file being read:

0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/dbs/hc_KNUTSEL.dat
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl

And shortly after that the datafiles are opened:

0      8       open:entry oracle /u01/app/oracle/product/11.2.0/dbhome_1/dbs/hc_KNUTSEL.dat
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/control01.ctl
0      8       open:entry oracle /u01/app/oracle/flash_recovery_area/KNUTSEL/control02.ctl
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/system01.dbf
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/system01.dbf
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/system01.dbf
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/sysaux01.dbf
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/sysaux01.dbf
0      8       open:entry oracle /u01/app/oracle/oradata/KNUTSEL/sysaux01.dbf

So just a showcase of what can be done with Dtrace. I’ll come back if I find more fun stuff.

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.

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