SlideShare une entreprise Scribd logo
1  sur  72
©2013	
  Enkitec	
  
Profiling	
  Oracle	
  with	
  gdb	
  
Hands	
  on!	
  
• Frits	
  Hoogland	
  
• Collaborate	
  2014,	
  Las	
  Vegas
1
This is the font size used for showing screen output. Be sure this is readable for you.
`whoami`
• Frits	
  Hoogland	
  
• Working	
  with	
  Oracle	
  products	
  since	
  1996	
  
!
• Blog:	
  hKp://fritshoogland.wordpress.com	
  
• TwiKer:	
  @fritshoogland	
  
• Email:	
  frits.hoogland@enkitec.com	
  
• Oracle	
  ACE	
  Director	
  
• OakTable	
  Member
2
Goals	
  &	
  prerequisites	
  
• Goal:	
  learn	
  aKendees	
  about	
  using	
  gdb	
  for	
  
profiling	
  C	
  funcXon	
  sequences.	
  
!
• Prerequisites:	
  
– Understanding	
  of	
  (internal)	
  execuXon	
  of	
  C	
  programs.	
  
– Understanding	
  of	
  Oracle	
  tracing	
  mechanisms.
3
Copy	
  the	
  virtual	
  box	
  VM
• The	
  virtual	
  box	
  importable	
  appliance	
  should	
  be	
  
distributed	
  (USB	
  HDD/Thumbdrive)	
  
!
• See	
  handout	
  for	
  virtual	
  machine/appliance	
  
instrucXons	
  and	
  requirements.
4
1.	
  Tracing
• In	
  order	
  to	
  troubleshoot	
  a	
  situaXon,	
  the	
  right	
  
tool	
  needs	
  to	
  be	
  selected.	
  
– Depending	
  on	
  that	
  outcome,	
  further	
  invesXgaXon	
  can	
  
be	
  done,	
  possibly	
  at	
  different	
  layers	
  with	
  different	
  
tools.	
  
!
• The	
  most	
  logical	
  way	
  to	
  start	
  troubleshoot	
  
Oracle	
  database	
  processing	
  is	
  using	
  the	
  wait	
  
interface	
  and	
  database	
  staXsXcs.
5
1.	
  Tracing
• Hands	
  on:	
  
– logon	
  to	
  the	
  VM	
  as	
  oracle	
  
– logon	
  to	
  Oracle:	
  	
  
rs ts/ts@//localhost/v11204!
!
– trace	
  ‘select	
  count(*)	
  from	
  t2’:	
  
select count(*) from t2; --this is prewarming the caching of the VM disk !
alter session set events ‘sql_trace level 8’; !
select count(*) from t2; !
alter session set events ‘sql_trace off’;
6
1.	
  Tracing
• Copy	
  the	
  resulXng	
  trace	
  file	
  to	
  ~/1.trc	
  
– When	
  looking	
  in	
  the	
  trace	
  file	
  
• if	
  you’ve	
  got	
  a	
  fast	
  disk	
  
• a	
  low	
  #	
  of	
  ‘direct	
  path	
  read’	
  waits	
  is	
  visible	
  
!
– Look	
  at	
  waits	
  +	
  fetch	
  line	
  (p+cr)
7
1.	
  Tracing
• What	
  is	
  happening?	
  
• Obviously,	
  there	
  is	
  PIO	
  informaXon	
  missing.	
  
!
• The	
  next	
  logical	
  step	
  is	
  to	
  include	
  system	
  call	
  
(regular	
  IO	
  is	
  done	
  using	
  a	
  system	
  call)	
  
informaXon	
  with	
  the	
  trace	
  informaXon.
8
1.	
  Tracing
• This	
  is	
  done	
  using	
  the	
  linux	
  uXlity	
  ‘strace’.	
  
!
• First	
  flush	
  the	
  buffer	
  cache:	
  
sq!
alter system flush buffer_cache;!
!
• Then	
  start	
  a	
  sqlplus	
  session	
  to	
  trace:	
  
rs ts/ts@//localhost/v11204!
!
• Start	
  a	
  root	
  (shell)	
  session
9
1.	
  Tracing
• Enable	
  sql_trace	
  at	
  level	
  8	
  in	
  the	
  sqlplus	
  session:	
  
alter session set events ‘sql_trace level 8’!
!
• Find	
  the	
  foreground	
  in	
  the	
  root	
  session:	
  
ps -ef | grep [L]OCAL=NO!
!
• And	
  strace	
  it	
  with	
  verbosity	
  on	
  the	
  write	
  call:	
  
strace -e write=all -e all -p PID -o ~oracle/2.trc!
!
• Start	
  a	
  root	
  (shell)	
  session.
10
1.	
  Tracing
• Now	
  execute	
  the	
  count(*)	
  again	
  in	
  the	
  sqlplus	
  
session.	
  
select count(*) from t2;!
!
• Aoer	
  the	
  count(*)	
  is	
  finised,	
  press	
  CTRL-­‐c	
  in	
  the	
  
strace	
  session.	
  
!
• And	
  exit	
  the	
  sqlplus	
  session.	
  
exit
11
1.	
  Tracing
• Now	
  open	
  the	
  strace	
  file	
  in	
  the	
  oracle	
  session:	
  
less 2.trc!
!
• And	
  skip	
  to	
  the	
  start	
  of	
  the	
  execuXon	
  of	
  the	
  
count(*)	
  statement:	
  
/count
12
1.	
  Tracing
statfs("/u01/app/oracle/oradata/V11204/o1_mf_ts_9jvyr69l_.dbf",
{f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=2162434, f_bfree=1108067,
f_bavail=992458, f_files=558624, f_ffree=504033, f_fsid={-602411700, -1491991187},
f_namelen=255, f_frsize=4096}) = 0!
open("/u01/app/oracle/oradata/V11204/o1_mf_ts_9jvyr69l_.dbf", O_RDWR|O_DSYNC|
O_DIRECT) = 10!
getrlimit(RLIMIT_NOFILE, {rlim_cur=64*1024, rlim_max=64*1024}) = 0!
fcntl(10, F_DUPFD, 256) = 257!
close(10) = 0!
fcntl(257, F_SETFD, FD_CLOEXEC) = 0!
fstatfs(257, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=2162434,
f_bfree=1108067, f_bavail=992458, f_files=558624, f_ffree=504033,
f_fsid={-602411700, -1491991187}, f_namelen=255, f_frsize=4096}) = 0!
write(8, "WAIT #140425323829824: nam='Disk"..., 130) = 130!
| 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |!
| 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 44 69 73 6b 29824: n am='Disk |!
| 00020 20 66 69 6c 65 20 6f 70 65 72 61 74 69 6f 6e 73 file op erations |!
| 00030 20 49 2f 4f 27 20 65 6c 61 3d 20 38 34 39 20 46 I/O' el a= 849 F |!
| 00040 69 6c 65 4f 70 65 72 61 74 69 6f 6e 3d 32 20 66 ileOpera tion=2 f |!
| 00050 69 6c 65 6e 6f 3d 35 20 66 69 6c 65 74 79 70 65 ileno=5 filetype |!
13
1.	
  Tracing
pread(257, "#24200202]@1P&6000142073100000000000000"...,
8192, 196100096) = 8192!
write(8, "WAIT #140425323829824: nam='db f"..., 124) = 124!
| 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |!
| 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 62 20 66 29824: n am='db f |!
| 00020 69 6c 65 20 73 65 71 75 65 6e 74 69 61 6c 20 72 ile sequ ential r |!
| 00030 65 61 64 27 20 65 6c 61 3d 20 39 36 34 30 20 66 ead' ela = 9640 f |!
| 00040 69 6c 65 23 3d 35 20 62 6c 6f 63 6b 23 3d 32 33 ile#=5 b lock#=23 |!
| 00050 39 33 38 20 62 6c 6f 63 6b 73 3d 31 20 6f 62 6a 938 bloc ks=1 obj |!
| 00060 23 3d 32 30 30 34 35 20 74 69 6d 3d 31 33 39 32 #=20045 tim=1392 |!
| 00070 38 39 37 31 39 34 37 31 33 30 33 31 89719471 3031 |!
| 00080 38 36 86 |
14
1.	
  Tracing
mmap(NULL,524288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_NORESERVE,6,0x6d000) = 0x7fb7516c2000!
mmap(0x7fb7516c2000,65536,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,6, 0) = 0x7fb7516c2000!
mmap(NULL,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_NORESERVE,6,0xed000) = 0x7fb7515b2000!
mmap(0x7fb7515b2000,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,6,0) = 0x7fb7515b2000!
io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1!
mmap(NULL,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_NORESERVE,6,0x1fd000)= 0x7fb7514a2000!
mmap(0x7fb7514a2000,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,6,0) = 0x7fb7514a2000!
io_submit(140425370206208, 1, {{0x7fb7516c4bc0, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,1,128,{{0x7fb7516c45e8,0x7fb7516c45e8,106496,0}}, {600, 0}) = 1!
write(8, "WAIT #140425323829824: nam='dire"..., 130) = 130!
| 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |!
| 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 69 72 65 29824: n am='dire |!
| 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |!
| 00030 61 3d 20 31 31 30 31 20 66 69 6c 65 20 6e 75 6d a= 1101 file num |!
| 00040 62 65 72 3d 35 20 66 69 72 73 74 20 64 62 61 3d ber=5 fi rst dba= |!
| 00050 32 33 39 33 39 20 62 6c 6f 63 6b 20 63 6e 74 3d 23939 bl ock cnt= |!
| 00060 31 33 20 6f 62 6a 23 3d 32 30 30 34 35 20 74 69 13 obj#= 20045 ti |!
| 00070 6d 3d 31 33 39 32 38 39 37 31 39 34 37 31 35 35 m=139289 71947155 |!
| 00080 35 33 53 |
15
1.	
  Tracing
• So,	
  it	
  looks	
  like	
  when	
  IOs	
  are	
  reaped*,	
  Oracle	
  
registers	
  a	
  wait.	
  
!
• But	
  that	
  isn’t	
  consistent	
  with	
  the	
  low	
  number	
  
of	
  ‘direct	
  path	
  read’	
  waits…	
  
!
• Let’s	
  look	
  further	
  in	
  2.trc	
  to	
  the	
  AIO	
  calls:
16
1.	
  Tracing
io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,2,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {0, 0}) = 1!
io_submit(140425370206208, 1, {{0x7fb7516c4bc0, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,2,128,{{0x7fb7516c45e8,0x7fb7516c45e8,1032192, 0}}, {0, 0}) = 1!
io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,1,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {600,0}) = 1!
write(8, "WAIT #140425323829824: nam='dire"..., 130) = 130!
| 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |!
| 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 69 72 65 29824: n am='dire |!
| 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |!
| 00030 61 3d 20 36 30 35 20 66 69 6c 65 20 6e 75 6d 62 a= 605 f ile numb |!
| 00040 65 72 3d 35 20 66 69 72 73 74 20 64 62 61 3d 32 er=5 fir st dba=2 |!
| 00050 35 34 37 34 20 62 6c 6f 63 6b 20 63 6e 74 3d 31 5474 blo ck cnt=1 |!
| 00060 32 36 20 6f 62 6a 23 3d 32 30 30 34 35 20 74 69 26 obj#= 20045 ti |!
| 00070 6d 3d 31 33 39 32 38 39 37 31 39 34 37 34 32 36 m=139289 71947426 |!
| 00080 38 31 81 |
17
1.	
  Tracing
• Okay,	
  for	
  some	
  reason:	
  
• some	
  reaped	
  IOs	
  do	
  result	
  in	
  a	
  wait	
  line,	
  
• and	
  some	
  other’s	
  do	
  not.	
  
!
• We	
  can	
  safely	
  assume	
  it	
  has	
  to	
  do	
  with	
  the	
  IO	
  
speed,	
  but	
  how	
  is	
  the	
  decision	
  made?
18
1.	
  Tracing
• In	
  order	
  to	
  find	
  out,	
  we	
  need	
  to	
  look	
  at	
  the	
  
sequence	
  of	
  funcXon	
  calls	
  in(side)	
  the	
  database.	
  
This	
  is	
  done	
  using	
  gdb.	
  
!
• Create	
  a	
  root	
  (shell)	
  session	
  for	
  gdb,	
  and	
  an	
  
oracle	
  (shell)	
  session	
  for	
  sqlplus	
  (rs	
  ts/ts@//
localhost/v11204).
19
1.	
  Tracing
• In	
  the	
  root	
  session	
  
• grep	
  the	
  PID	
  of	
  the	
  foreground	
  session:	
  
ps -ef | grep [L]OCAL=NO!
!
• AKach	
  to	
  the	
  session	
  with	
  gdb:	
  
gdb -p PID!
!
• Enter	
  the	
  commands	
  on	
  the	
  next	
  slide	
  in	
  gdb:
20
1.	
  Tracing
set pagination off!
set logging file /home/oracle/3.trc!
set logging on!
break io_submit!
break 'io_getevents@plt'!
rbreak ^kslwt[be]ctx!
commands 1-4!
c!
end
21
1.	
  Tracing
• This	
  has	
  set	
  4	
  breakpoints	
  in	
  gdb:	
  
!
(gdb) info break!
Num Type Disp Enb Address What!
1 breakpoint keep y 0x00007fcaa5083660 <io_submit>!
c!
2 breakpoint keep y 0x00000000009e5b58 <io_getevents@plt>!
c!
3 breakpoint keep y 0x0000000008c18680 <kslwtbctx+4>!
c!
4 breakpoint keep y 0x0000000008c1f92c <kslwtectx+4>!
c
22
1.	
  Tracing
• In	
  gdb,	
  issue	
  ‘c’	
  to	
  conXnue	
  the	
  foreground	
  
session:	
  
!
• In	
  sqlplus,	
  execute:	
  
select count(*) from t2;
23
1.	
  Tracing
• Once	
  the	
  select	
  count(*)	
  is	
  ready:	
  
• Stop	
  gdb	
  (CTRL-­‐c,	
  q)	
  
• Exit	
  sqlplus,	
  and	
  read	
  3.trc	
  using	
  less:	
  
less 3.trc
24
1.	
  Tracing
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
!
Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1!
!
Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1!
!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
!
Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1!
!
Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1!
!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()
25
1.	
  Tracing
• This	
  shows:	
  	
  
• Oracle	
  ending	
  the	
  Xming	
  of	
  a	
  wait	
  (kslwtectx())	
  
• Then	
  another	
  wait	
  is	
  encountered	
  (kslwtbctx()-­‐
kslwtectx())	
  
• Then	
  IOs	
  are	
  submiKed	
  (io_submit())	
  and	
  IOs	
  
are	
  reaped	
  (io_getevents())	
  
• In	
  this	
  example:	
  without	
  a	
  wait	
  event!
26
1.	
  Tracing
• In	
  my	
  case,	
  I	
  didn’t	
  get	
  a	
  single	
  wait	
  
accompanying	
  IO	
  (io_submit()-­‐io_getevents())	
  
because	
  I	
  turned	
  virtual	
  box	
  disk	
  caching	
  on.	
  
!
• Let’s	
  slow	
  the	
  IOs	
  down	
  to	
  get	
  the	
  ‘direct	
  path	
  
read’	
  waits	
  back.
27
1.	
  Tracing
• Startup	
  a	
  sqlplus	
  session	
  again	
  (as	
  oracle).	
  
rs ts/ts@//localhost/v11204!
!
• (as	
  root)	
  Now	
  setup	
  IO	
  throKling	
  using	
  cgroups:	
  
mkdir -p /cgroup/blkio!
mount -t cgroup -o blkio none /cgroup/blkio!
cgcreate -g blkio:/iothrottle!
cgset -r blkio.throttle.read_iops_device="8:0 1" iothrottle
28
1.	
  Tracing
• Find	
  the	
  PID	
  of	
  the	
  server	
  process:	
  
ps -ef | grep [L]OCAL=NO!
!
• And	
  throKle	
  the	
  Oracle	
  process:	
  
echo PID > /cgroup/blkio/iothrottle/tasks!
!
• Enter	
  gdb	
  again,	
  and	
  setup	
  the	
  breakpoints	
  
gdb -p PID
29
1.	
  Tracing
set pagination off!
set logging file /home/oracle/4.trc!
set logging on!
break io_submit!
break 'io_getevents@plt'!
rbreak ^kslwt[be]ctx!
commands 1-4!
c!
end
30
1.	
  Tracing
• Make	
  the	
  server	
  session	
  runnable	
  again	
  in	
  gdb	
  
by	
  execuXng	
  ‘c’	
  for	
  conXnue.	
  
• Now	
  run	
  the	
  query	
  again:	
  
select count(*) from t2;!
!
• Once	
  the	
  query	
  is	
  finished,	
  quit	
  gdb	
  again	
  (CTRL-­‐
c	
  and	
  q),	
  quit	
  sqlplus,	
  and	
  look	
  in	
  4.trc	
  with	
  less.
31
1.	
  Tracing
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1!
Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()
32
1.	
  Tracing
• This	
  is	
  the	
  end	
  of	
  chapter	
  1.	
  
• In	
  this	
  chapter	
  you	
  have	
  learned:	
  
• How	
  to	
  start	
  a	
  sql_trace	
  
• How	
  to	
  combine	
  strace	
  with	
  sql_trace	
  
• How	
  to	
  use	
  gdb	
  to	
  break	
  and	
  conXnue	
  on	
  C	
  
funcXons,	
  in	
  order	
  to	
  profile.
33
2.	
  strace
• strace	
  shows	
  (only)	
  system	
  calls.	
  
• This	
  means	
  calls	
  which	
  require	
  kernel	
  
interacXon	
  from	
  the	
  user	
  land	
  process.	
  
• Things	
  like:	
  disk	
  I/O,	
  network	
  I/O,	
  allocaXon	
  
and	
  release	
  of	
  memory,	
  IPC,	
  etc.	
  
!
• Normal	
  data	
  processing	
  in	
  Oracle	
  happens	
  in	
  
“userland”,	
  thus	
  is	
  not	
  visible	
  with	
  strace.
34
2.	
  strace
• The	
  combinaXon	
  of	
  strace	
  +	
  sql_trace	
  is	
  
powerful,	
  and	
  gives	
  more	
  insight.	
  
• In	
  our	
  example,	
  it	
  shows	
  some	
  I/Os	
  indeed	
  are	
  
not	
  instrumented.	
  
!
• strace	
  shows	
  the	
  result	
  of	
  the	
  system	
  call	
  (!)	
  
• This	
  means	
  it	
  shows	
  the	
  return	
  code	
  of	
  the	
  
call.
35
io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,2,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {0, 0}) = 1!
io_submit(140425370206208, 1, {{0x7fb7516c4bc0, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,2,128,{{0x7fb7516c45e8,0x7fb7516c45e8,1032192, 0}}, {0, 0}) = 1!
io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1!
io_getevents(140425370206208,1,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {600,0}) = 1!
write(8, "WAIT #140425323829824: nam='dire"..., 130) = 130!
| 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |!
| 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 69 72 65 29824: n am='dire |!
| 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |!
| 00030 61 3d 20 36 30 35 20 66 69 6c 65 20 6e 75 6d 62 a= 605 f ile numb |!
| 00040 65 72 3d 35 20 66 69 72 73 74 20 64 62 61 3d 32 er=5 fir st dba=2 |!
| 00050 35 34 37 34 20 62 6c 6f 63 6b 20 63 6e 74 3d 31 5474 blo ck cnt=1 |!
| 00060 32 36 20 6f 62 6a 23 3d 32 30 30 34 35 20 74 69 26 obj#= 20045 ti |!
| 00070 6d 3d 31 33 39 32 38 39 37 31 39 34 37 34 32 36 m=139289 71947426 |!
| 00080 38 31 81 |
strace	
  -­‐	
  IOs	
  with	
  no	
  event
36
2.	
  strace
• A	
  lesser	
  known	
  ‘feature’	
  of	
  strace	
  is	
  it	
  can	
  leave	
  
out	
  system	
  calls.	
  
• This	
  is	
  how	
  a	
  sql_trace	
  at	
  level	
  8	
  plus	
  strace	
  
looks	
  like	
  on	
  an	
  IO	
  thro(led	
  process
37
2.	
  strace
• strace	
  does	
  not	
  leave	
  out	
  system	
  calls!	
  
• There	
  is	
  a	
  shortcut/opXmisaXon	
  in	
  libaio	
  to	
  
prevent	
  the	
  call	
  io_getevents	
  from	
  becoming	
  a	
  
system	
  call.	
  
• This	
  is	
  possible	
  because	
  the	
  IO	
  results	
  are	
  
available	
  in	
  userspace.	
  
• Want	
  to	
  know	
  more	
  about	
  this?	
  See:	
  hKp://
fritshoogland.wordpress.com/2014/03/11/
linux-­‐strace-­‐doesnt-­‐lie-­‐aoer-­‐all/
38
io_submit(140691720466432, 1, {{0x7ff55522de00, 0, 0, 0, 257}}) = 1!
io_getevents(140691720466432, 1, 128, {{0x7ff55522e3d8, 0x7ff55522e3d8, 1032192, 0}}, {600,
0}) = 1!
times({tms_utime=7, tms_stime=6, tms_cutime=0, tms_cstime=0}) = 430581853!
write(8, "n*** 2014-02-21 13:44:15.163n", 29) = 29!
| 00000 0a 2a 2a 2a 20 32 30 31 34 2d 30 32 2d 32 31 20 .*** 201 4-02-21 |!
| 00010 31 33 3a 34 34 3a 31 35 2e 31 36 33 0a 13:44:15 .163. |!
lseek(8, 0, SEEK_CUR) = 5276!
write(8, "WAIT #140691674130488: nam='dire"..., 134) = 134!
| 00000 57 41 49 54 20 23 31 34 30 36 39 31 36 37 34 31 WAIT #14 06916741 |!
| 00010 33 30 34 38 38 3a 20 6e 61 6d 3d 27 64 69 72 65 30488: n am='dire |!
| 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |!
| 00030 61 3d 20 31 39 39 37 39 37 36 20 66 69 6c 65 20 a= 19979 76 file |!
| 00040 6e 75 6d 62 65 72 3d 35 20 66 69 72 73 74 20 64 number=5 first d |!
| 00050 62 61 3d 32 35 30 39 30 20 62 6c 6f 63 6b 20 63 ba=25090 block c |!
| 00060 6e 74 3d 31 32 36 20 6f 62 6a 23 3d 32 30 30 34 nt=126 o bj#=2004 |!
| 00070 35 20 74 69 6d 3d 31 33 39 32 39 38 36 36 35 35 5 tim=13 92986655 |!
| 00080 31 36 33 33 39 31 163391 |
2.	
  strace
39
2.	
  strace
• This	
  is	
  how	
  it	
  looks	
  like	
  when	
  the	
  same	
  is	
  done	
  
using	
  gdb:
40
2.	
  strace
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1!
Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()!
Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()!
Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()!
Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()
41
2.	
  strace
• With	
  strace,	
  we	
  see:	
  
• single	
  io_submit()	
  
• followed	
  by	
  a	
  single	
  io_getevents()	
  
!
• With	
  gdb,	
  we	
  see:	
  
• single	
  io_submit()	
  
• followed	
  by	
  3	
  io_getevents()	
  calls.
42
2.	
  strace
• IMPORTANT!	
  
– With	
  strace,	
  system	
  calls	
  are	
  shown.	
  
– With	
  write	
  output,	
  we	
  see	
  the	
  Oracle	
  wait	
  events	
  
– When	
  waits	
  follow	
  a	
  system	
  call	
  or	
  system	
  calls,	
  we	
  
can	
  assume	
  the	
  wait	
  is	
  Xming	
  of	
  that.	
  
!
• There	
  is	
  no	
  way	
  to	
  tell	
  what	
  the	
  wait	
  did	
  actually	
  
Xme!!
43
2.	
  strace
• This	
  is	
  the	
  end	
  of	
  chapter	
  2.	
  
• In	
  this	
  chapter	
  you	
  have	
  learned:	
  
• What	
  strace	
  does.	
  
• What	
  limitaXon	
  strace	
  has	
  (no	
  user	
  land).	
  
• That	
  strace	
  can’t	
  tell	
  you	
  what	
  a	
  wait	
  event	
  
actually	
  did	
  Xme.	
  
• That	
  it	
  can	
  leave	
  out	
  system	
  calls.
44
3.	
  gdb	
  theory
• gdb	
  is	
  the	
  GNU	
  debugger.	
  
• hKp://www.sourceware.org/gdb/	
  
• DescripXon	
  from	
  the	
  website:	
  
!
GDB can do four main kinds of things (plus other things in support of these) to help you catch
bugs in the act:	

	

 •	

 Start your program, specifying anything that might affect its behavior.	

	

 •	

 Make your program stop on specified conditions.	

	

 •	

 Examine what has happened, when your program has stopped.	

	

 •	

 Change things in your program, so you can experiment with correcting the effects of one bug
and go on to learn about another.	

!
The program being debugged can be written in Ada, C, C++, Objective-C, Pascal (and many other
languages). Those programs might be executing on the same machine as GDB (native) or on
another machine (remote). GDB can run on most popular UNIX and Microsoft Windows variants.	

! 45
3.	
  gdb	
  theory
• For	
  profiling,	
  we	
  use	
  the	
  ‘make	
  your	
  program	
  
stop	
  on	
  specified	
  condiXons’.	
  
• However,	
  we	
  just	
  use	
  the	
  stop	
  noXficaXon,	
  and	
  
make	
  the	
  process	
  conXnue.	
  	
  
!
• To	
  make	
  full	
  use	
  of	
  the	
  gdb	
  funcXonality,	
  the	
  
executable	
  needs	
  to	
  be	
  compiled	
  with	
  the	
  ‘-­‐g’	
  
flag	
  to	
  include	
  debug	
  informaXon.
46
3.	
  gdb	
  theory
• By	
  default,	
  executables	
  do	
  not	
  have	
  debug	
  
informaXon	
  added.	
  
!
• Debug	
  informaXon	
  makes	
  it	
  able	
  to	
  relate	
  C-­‐code	
  
lines	
  to	
  steps	
  of	
  execuXon	
  of	
  the	
  executable.	
  
!
• As	
  you	
  might	
  expect	
  at	
  this	
  point:	
  Oracle	
  doesn’t	
  
include	
  this	
  informaXon.
47
3.	
  gdb	
  theory
• So…why	
  talk	
  about	
  gdb	
  and	
  Oracle	
  then?	
  
• Of	
  course	
  we	
  sXll	
  can	
  use	
  it,	
  that	
  is	
  what	
  this	
  
talk	
  about.	
  
!
• Oracle	
  on	
  linux	
  is	
  an	
  ‘ELF’	
  executable.	
  
!
[oracle@ol65vm [v11204] bin]$ file oracle!
oracle: setuid setgid ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
48
3.	
  gdb	
  theory
• It	
  says	
  ‘not	
  stripped’	
  
• Which	
  means	
  funcXon	
  symbolic	
  informaXon	
  is	
  
NOT	
  removed.	
  
!
• It	
  is	
  dynamically	
  linked!	
  
• An	
  executable	
  has	
  to	
  symbolically	
  call	
  
funcXons	
  in	
  a	
  library.
49
3.	
  gdb	
  theory
• Check	
  on	
  dynamically	
  loaded	
  libraries	
  with	
  ‘ldd’:	
  
!
[oracle@ol65vm [v11204] bin]$ ldd oracle!
! linux-vdso.so.1 => (0x00007fffc0dfe000)!
! libodm11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libodm11.so
(0x00007fdb6d75e000)!
! libcell11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libcell11.so
(0x00007fdb6d5fa000)!
! libskgxp11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxp11.so
(0x00007fdb6d424000)!
! libaio.so.1 => /lib64/libaio.so.1 (0x00007fdb6bcea000)!
! libdl.so.2 => /lib64/libdl.so.2 (0x00007fdb6bae5000)!
! libm.so.6 => /lib64/libm.so.6 (0x00007fdb6b861000)!
! libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdb6b644000)!
! libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fdb6b42a000)!
! libc.so.6 => /lib64/libc.so.6 (0x00007fdb6b096000)!
! /lib64/ld-linux-x86-64.so.2 (0x00007fdb6d861000)!
(partial listing)
50
3.	
  gdb	
  theory
• In	
  order	
  to	
  call	
  a	
  funcXon	
  in	
  a	
  library,	
  it	
  needs	
  to	
  be	
  
defined	
  somewhere	
  in	
  the	
  executable:	
  
• Procedure	
  Linkage	
  Table	
  (plt).	
  
• Libraries	
  and	
  funcXons	
  are	
  lazy	
  loaded.	
  
!
[oracle@ol65vm [v11204] bin]$ readelf -a oracle | grep io_getevents!
00000b5de698 00fc00000007 R_X86_64_JUMP_SLO 0000000000000000 io_getevents + 0!
252: 0000000000000000 0 FUNC WEAK DEFAULT UND io_getevents@LIBAIO_0.4 (11)!
633326: 0000000000000000 0 FUNC WEAK DEFAULT UND io_getevents@@LIBAIO_0.4
51
3.	
  gdb	
  theory
• The	
  reason	
  for	
  showing	
  the	
  plt:	
  
!
• The	
  funcXons	
  in	
  a	
  dynamically	
  linked	
  
executable	
  can	
  only	
  be	
  called	
  by	
  name.	
  
!
• So	
  the	
  library	
  is	
  free	
  to	
  have	
  the	
  funcXon	
  at	
  
any	
  offset.
52
3.	
  gdb	
  theory
• FuncXons	
  in	
  an	
  executable	
  can	
  be	
  found	
  using	
  
‘nm’,	
  if	
  it’s	
  not	
  stripped:	
  
!
[oracle@ol65vm [v11204] bin]$ nm -a oracle | grep kslwtbctx$!
0000000008c1867c T kslwtbctx!
53
3.	
  gdb	
  theory
• Again:	
  I	
  don’t	
  suspect	
  Oracle	
  to	
  ever	
  release	
  the	
  
debug	
  symbols	
  for	
  the	
  Oracle	
  executable.	
  
• Because	
  it	
  would	
  reveal	
  source	
  code.	
  
• This	
  also	
  means	
  that	
  gdb	
  does	
  not	
  understand	
  
the	
  funcXon	
  call	
  arguments.	
  
!
• But	
  Linux	
  is	
  open	
  source!
54
3.	
  gdb	
  theory
• Oracle	
  linux	
  has	
  a	
  complete	
  repository	
  with	
  the	
  
operaXng	
  system	
  and	
  uXliXes	
  compiled	
  with	
  
debug	
  symbols:	
  the	
  debug	
  info	
  packages.	
  
• hKps://oss.oracle.com/ol6/debuginfo	
  
!
• For	
  the	
  sake	
  of	
  this	
  course,	
  I	
  created	
  a	
  directory	
  
~root/debuginfo_rpms	
  in	
  which	
  the	
  relevant	
  
debuginfo	
  rpms	
  are	
  put.	
  
55
3.	
  gdb	
  theory
• Install	
  the	
  debug	
  info	
  packages	
  from	
  that	
  
directory:	
  
[oracle@ol65vm [] ~]$ su -!
Password: !
[root@ol65vm ~]# cd ~/debuginfo_rpms/!
[root@ol65vm debuginfo_rpms]# yum localinstall *!
Setting up Local Package Process!
Examining glibc-debuginfo-2.12-1.132.el6.x86_64.rpm: glibc-
debuginfo-2.12-1.132.el6.x86_64!
…!
Total size: 54 M!
Installed size: 54 M!
Is this ok [y/N]: y!
…
56
3.	
  gdb	
  theory
• Verify	
  the	
  installed	
  debug	
  info	
  packages:	
  
[root@ol65vm debuginfo_rpms]# rpm -qa | grep debuginfo!
!
glibc-debuginfo-common-2.12-1.132.el6.x86_64!
libaio-debuginfo-0.3.107-10.el6.x86_64!
glibc-debuginfo-2.12-1.132.el6.x86_64
57
3.	
  gdb	
  theory
• Now	
  let’s	
  setup	
  a	
  normal	
  database	
  connecXon	
  
again:	
  
[oracle@ol65vm [v11204] bin]$ rs ts/ts@//localhost/v11204!
!
• Find	
  the	
  PID	
  of	
  the	
  server	
  process	
  in	
  a	
  root	
  
session,	
  and	
  aKach	
  to	
  it	
  with	
  gdb	
  again:	
  
[root@ol6vm ~]# ps -ef | grep [L]OCAL=NO!
oracle 2657 1 0 02:22 ? 00:00:00 oraclev11204 (LOCAL=NO)!
[root@ol6vm ~]# gdb -p 2657
58
3.	
  gdb	
  theory
• Enter	
  the	
  following	
  in	
  the	
  gdb	
  session:	
  
set pagination off!
break io_submit!
break io_getevents_0_4!
c!
!
• This	
  makes	
  the	
  sqlplus	
  session	
  runnable	
  again.	
  
select count(*) from t2;
59
3.	
  gdb	
  theory
• Because	
  we	
  didn’t	
  specify	
  conXnue	
  as	
  acXon	
  
with	
  a	
  break,	
  gdb	
  breaks	
  execuXon.	
  
• Look	
  what	
  gdb	
  tells	
  you	
  with	
  io_submit():	
  
Breakpoint 1, io_submit (ctx=0x7ff8b626c000, nr=1, iocbs=0x7fffa5c31a80) at
io_submit.c:23!
23!io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr,
struct iocb **, iocbs)!
• conXnue	
  unXl	
  you	
  get	
  a	
  io_getevents():	
  
Breakpoint 2, io_getevents_0_4 (ctx=0x7ff8b626c000, min_nr=2, nr=128,
events=0x7fffa5c37b68, timeout=0x7fffa5c38b70) at io_getevents.c:46!
46!! if (ring==NULL || ring->magic != AIO_RING_MAGIC)
60
3.	
  gdb	
  theory
• Using	
  the	
  debug	
  info	
  package,	
  gdb	
  can	
  interpret	
  
system	
  calls	
  arguments	
  for	
  which	
  the	
  debug	
  
informaXon	
  has	
  been	
  installed!	
  
• This	
  allows	
  you	
  to	
  see	
  quite	
  a	
  lot.	
  
!
• Important:	
  gdb	
  breaks	
  if	
  the	
  funcXon	
  is	
  entered.	
  
This	
  means	
  we	
  can	
  not	
  read	
  the	
  return	
  code	
  of	
  
the	
  funcXon	
  we	
  are	
  breaking	
  on!	
  
• io_getevents()	
  returns	
  ready	
  IOs.
61
3.	
  gdb	
  theory
• Quit	
  the	
  gdb	
  (root)	
  session	
  (q).	
  
• Quit	
  the	
  sqlplus	
  (oracle)	
  session.	
  
!
• In	
  the	
  oracle	
  session:	
  
cd ~/gdb_macros!
sq!
@create_pw!
@create_pl!
exit
62
3.	
  gdb	
  theory
• Now	
  setup	
  a	
  normal	
  oracle	
  connecXon	
  again:	
  
rs ts/ts@//localhost/v11204!
!
• And	
  setup	
  a	
  gdb	
  session	
  from	
  ~oracle/
gdb_macros	
  and	
  aKach	
  to	
  the	
  oracle	
  session:	
  
cd ~oracle/gdb_macros!
ps -ef | grep [L]OCAL=NO!
gdb -p PID
63
3.	
  gdb	
  theory
• Now	
  use	
  some	
  already	
  prepared	
  gdb	
  macros:	
  
source pstruct.gdb!
source paio.gdb!
source pw.gdb!
c!
!
• And	
  start	
  ‘select	
  count(*)	
  from	
  t2;’	
  from	
  the	
  
sqlplus	
  session.
64
3.	
  gdb	
  theory
• Now	
  look	
  what	
  is	
  visible	
  with	
  the	
  three	
  gdb	
  
macros:	
  
kslwtectx -- Previous wait time: 74621038: SQL*Net message from client!
opiosq0 -- parse!
kksfbc -- V$SQL.ADDRESS: 78d7a6d8!
opiexe -- execute!
kslwtbctx!
kslwtectx -- Previous wait time: 1195: SQL*Net message to client!
opifch2 -- fetch!
kslwtbctx!
io_submit - 1,58f5c000 - nr,ctx!
fd: 256, nbytes: 1!
io_getevents - 1,58f5c000 - minnr,ctx,timeout: $1 = {tv_sec = 10, tv_nsec = 0}!
kslwtectx -- Previous wait time: 70121: Disk file operations I/O!
65
3.	
  gdb	
  theory
• This	
  explains	
  the	
  direct	
  path	
  read	
  waits:	
  
• This	
  is	
  done	
  with	
  cgroups	
  IO	
  throKling	
  
opifch2 -- fetch!
io_submit - 1,58f5c000 - nr,ctx!
fd: 256, nbytes: 106496!
io_submit - 1,58f5c000 - nr,ctx!
fd: 256, nbytes: 122880!
io_getevents - 2,58f5c000 - minnr,ctx,timeout: $1 = {tv_sec = 0, tv_nsec = 0}!
io_getevents - 2,58f5c000 - minnr,ctx,timeout: $2 = {tv_sec = 0, tv_nsec = 0}!
kslwtbctx!
io_getevents - 1,58f5c000 - minnr,ctx,timeout: $3 = {tv_sec = 600, tv_nsec = 0}!
kslwtectx -- Previous wait time: 946495: direct path read
66
3.	
  gdb	
  theory
• This	
  is	
  the	
  end	
  of	
  chapter	
  3.	
  
• In	
  this	
  chapter	
  you	
  have	
  learned:	
  
• What	
  gdb	
  is.	
  
• What	
  debug	
  symbols	
  are	
  and	
  how	
  to	
  get	
  
them.	
  
• What	
  stripped	
  and	
  not	
  stripped	
  means.	
  
• oracle	
  as	
  dynamically	
  linked	
  executable.	
  
• procedure	
  linkage	
  table	
  and	
  finding	
  funcXons	
  
• how	
  to	
  break	
  on	
  funcXons
67
3.	
  gdb	
  theory
• The	
  breaking	
  in	
  gdb	
  happens	
  on	
  entering	
  a	
  
funcXon	
  call.	
  
• The	
  existence	
  of	
  gdb	
  macro’s	
  created	
  by	
  
Enkitec	
  to	
  obtain	
  more	
  informaXon.
68
4.	
  gdb	
  lab
• What	
  does	
  the	
  wait	
  event	
  ‘direct	
  path	
  read’	
  mean	
  
• Enable	
  synchronous	
  IO	
  for	
  the	
  database	
  now.	
  
• filesystemio_opXons=‘none’	
  
• Now	
  trace	
  the	
  ‘select	
  count(*)	
  from	
  t2’	
  again	
  
with	
  gdb.	
  
• What	
  wait	
  event	
  indicates	
  IO	
  now?	
  What	
  does	
  
the	
  wait	
  event	
  Xme?	
  
• Turn	
  on	
  asynchronous	
  IO	
  again	
  when	
  finished.
69
4.	
  gdb	
  lab
• What	
  does	
  asynchronous	
  IO	
  mean	
  for	
  IO	
  calls?	
  
• Synchronous	
  IO	
  is	
  done	
  with	
  the	
  pread()	
  call.	
  
• Asynchronous	
  IO	
  is	
  done	
  with	
  the	
  calls	
  
io_submit()	
  and	
  io_getevents().	
  
• Flush	
  the	
  buffer	
  cache.	
  
• Trace	
  the	
  ‘select	
  count(*)	
  from	
  t2’	
  with	
  gdb.	
  
• What	
  IO	
  calls	
  are	
  done?
70
4.	
  gdb	
  lab
• What	
  does	
  SIO	
  mean	
  for	
  the	
  dbwr	
  wait	
  events?	
  
• Enable	
  synchronous	
  IO	
  for	
  the	
  database	
  now.	
  
• filesystemio_opXons=‘none’	
  
• The	
  dbwr	
  has	
  a	
  disXnct	
  write	
  wait	
  event.	
  
• Trace	
  the	
  dbwr	
  (set	
  db_writer_processes	
  to	
  1	
  if	
  
there	
  are	
  mulXple)	
  with	
  gdb.	
  
• Create	
  a	
  table,	
  insert	
  a	
  row,	
  commit	
  and	
  issue	
  
‘alter	
  system	
  checkpoint’.	
  
• Turn	
  on	
  asynchronous	
  IO	
  again	
  when	
  finished.
71
5.	
  Extra
• How	
  to	
  find	
  funcXon	
  names?	
  
– perf	
  
• Show	
  how	
  some	
  of	
  the	
  gdb	
  macro’s	
  are	
  made.	
  
• Explain	
  using	
  registers	
  to	
  find	
  funcXon	
  call	
  
arguments.
72

Contenu connexe

Tendances

In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneEnkitec
 
Performance Schema in Action: demo
Performance Schema in Action: demoPerformance Schema in Action: demo
Performance Schema in Action: demoSveta Smirnova
 
How to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsHow to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsSveta Smirnova
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sSveta Smirnova
 
Why Use EXPLAIN FORMAT=JSON?
 Why Use EXPLAIN FORMAT=JSON?  Why Use EXPLAIN FORMAT=JSON?
Why Use EXPLAIN FORMAT=JSON? Sveta Smirnova
 
SQL Plan Directives explained
SQL Plan Directives explainedSQL Plan Directives explained
SQL Plan Directives explainedMauro Pagano
 
Full Table Scan: friend or foe
Full Table Scan: friend or foeFull Table Scan: friend or foe
Full Table Scan: friend or foeMauro Pagano
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLJim Mlodgenski
 
Adapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12cAdapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12cMauro Pagano
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraSveta Smirnova
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Kyle Hailey
 
Summary tables with flexviews
Summary tables with flexviewsSummary tables with flexviews
Summary tables with flexviewsJustin Swanhart
 
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB ClusterHow to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB ClusterSveta Smirnova
 
Managing MariaDB Server operations with Percona Toolkit
Managing MariaDB Server operations with Percona ToolkitManaging MariaDB Server operations with Percona Toolkit
Managing MariaDB Server operations with Percona ToolkitSveta Smirnova
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Using Apache Spark and MySQL for Data Analysis
Using Apache Spark and MySQL for Data AnalysisUsing Apache Spark and MySQL for Data Analysis
Using Apache Spark and MySQL for Data AnalysisSveta Smirnova
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite PluginsSveta Smirnova
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 

Tendances (20)

In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry Osborne
 
Performance Schema in Action: demo
Performance Schema in Action: demoPerformance Schema in Action: demo
Performance Schema in Action: demo
 
How to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tearsHow to migrate from MySQL to MariaDB without tears
How to migrate from MySQL to MariaDB without tears
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]s
 
Why Use EXPLAIN FORMAT=JSON?
 Why Use EXPLAIN FORMAT=JSON?  Why Use EXPLAIN FORMAT=JSON?
Why Use EXPLAIN FORMAT=JSON?
 
SQL Plan Directives explained
SQL Plan Directives explainedSQL Plan Directives explained
SQL Plan Directives explained
 
Noinject
NoinjectNoinject
Noinject
 
Full Table Scan: friend or foe
Full Table Scan: friend or foeFull Table Scan: friend or foe
Full Table Scan: friend or foe
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
 
Adapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12cAdapting to Adaptive Plans on 12c
Adapting to Adaptive Plans on 12c
 
How to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with GaleraHow to Avoid Pitfalls in Schema Upgrade with Galera
How to Avoid Pitfalls in Schema Upgrade with Galera
 
Rac 12c optimization
Rac 12c optimizationRac 12c optimization
Rac 12c optimization
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle
 
Summary tables with flexviews
Summary tables with flexviewsSummary tables with flexviews
Summary tables with flexviews
 
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB ClusterHow to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
How to Avoid Pitfalls in Schema Upgrade with Percona XtraDB Cluster
 
Managing MariaDB Server operations with Percona Toolkit
Managing MariaDB Server operations with Percona ToolkitManaging MariaDB Server operations with Percona Toolkit
Managing MariaDB Server operations with Percona Toolkit
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Using Apache Spark and MySQL for Data Analysis
Using Apache Spark and MySQL for Data AnalysisUsing Apache Spark and MySQL for Data Analysis
Using Apache Spark and MySQL for Data Analysis
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 

En vedette

APEX Security Primer
APEX Security PrimerAPEX Security Primer
APEX Security PrimerEnkitec
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 ToolCarlos Sierra
 
Due Diligence with Exadata
Due Diligence with ExadataDue Diligence with Exadata
Due Diligence with ExadataEnkitec
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeEnkitec
 
Think Exa!
Think Exa!Think Exa!
Think Exa!Enkitec
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture PerformanceEnkitec
 
Controlling execution plans 2014
Controlling execution plans   2014Controlling execution plans   2014
Controlling execution plans 2014Enkitec
 
SQLT XPLORE: The SQLT XPLAIN hidden child
SQLT XPLORE: The SQLT XPLAIN hidden childSQLT XPLORE: The SQLT XPLAIN hidden child
SQLT XPLORE: The SQLT XPLAIN hidden childCarlos Sierra
 
SQL Tuning made easier with SQLTXPLAIN (SQLT)
SQL Tuning made easier with SQLTXPLAIN (SQLT)SQL Tuning made easier with SQLTXPLAIN (SQLT)
SQL Tuning made easier with SQLTXPLAIN (SQLT)Carlos Sierra
 
Engineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service DemonstrationEngineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service DemonstrationEnkitec
 
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...Carlos Sierra
 
Using Angular JS in APEX
Using Angular JS in APEXUsing Angular JS in APEX
Using Angular JS in APEXEnkitec
 
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan StabilityCarlos Sierra
 
How a Developer can Troubleshoot a SQL performing poorly on a Production DB
How a Developer can Troubleshoot a SQL performing poorly on a Production DBHow a Developer can Troubleshoot a SQL performing poorly on a Production DB
How a Developer can Troubleshoot a SQL performing poorly on a Production DBCarlos Sierra
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 ToolCarlos Sierra
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsCarlos Sierra
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeCarlos Sierra
 

En vedette (17)

APEX Security Primer
APEX Security PrimerAPEX Security Primer
APEX Security Primer
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
 
Due Diligence with Exadata
Due Diligence with ExadataDue Diligence with Exadata
Due Diligence with Exadata
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 
Think Exa!
Think Exa!Think Exa!
Think Exa!
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
 
Controlling execution plans 2014
Controlling execution plans   2014Controlling execution plans   2014
Controlling execution plans 2014
 
SQLT XPLORE: The SQLT XPLAIN hidden child
SQLT XPLORE: The SQLT XPLAIN hidden childSQLT XPLORE: The SQLT XPLAIN hidden child
SQLT XPLORE: The SQLT XPLAIN hidden child
 
SQL Tuning made easier with SQLTXPLAIN (SQLT)
SQL Tuning made easier with SQLTXPLAIN (SQLT)SQL Tuning made easier with SQLTXPLAIN (SQLT)
SQL Tuning made easier with SQLTXPLAIN (SQLT)
 
Engineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service DemonstrationEngineered Systems: Environment-as-a-Service Demonstration
Engineered Systems: Environment-as-a-Service Demonstration
 
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
Understanding How is that Adaptive Cursor Sharing (ACS) produces multiple Opt...
 
Using Angular JS in APEX
Using Angular JS in APEXUsing Angular JS in APEX
Using Angular JS in APEX
 
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
 
How a Developer can Troubleshoot a SQL performing poorly on a Production DB
How a Developer can Troubleshoot a SQL performing poorly on a Production DBHow a Developer can Troubleshoot a SQL performing poorly on a Production DB
How a Developer can Troubleshoot a SQL performing poorly on a Production DB
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 

Similaire à Profiling Oracle with GDB

Profiling of Oracle Function Calls
Profiling of Oracle Function CallsProfiling of Oracle Function Calls
Profiling of Oracle Function CallsEnkitec
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON
 
Windows kernel debugging workshop in florida
Windows kernel debugging   workshop in floridaWindows kernel debugging   workshop in florida
Windows kernel debugging workshop in floridaSisimon Soman
 
Windows debugging sisimon
Windows debugging   sisimonWindows debugging   sisimon
Windows debugging sisimonSisimon Soman
 
Hacklu11 Writeup
Hacklu11 WriteupHacklu11 Writeup
Hacklu11 Writeupnkslides
 
Understanding Performance with DTrace
Understanding Performance with DTraceUnderstanding Performance with DTrace
Understanding Performance with DTraceahl0003
 
Porting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPUPorting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPUYann Sionneau
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupBadoo Development
 
Java bytecode Malware Analysis
Java bytecode Malware AnalysisJava bytecode Malware Analysis
Java bytecode Malware AnalysisBrian Baskin
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨flyinweb
 
Reverse engineering of binary programs for custom virtual machines
Reverse engineering of binary programs for custom virtual machinesReverse engineering of binary programs for custom virtual machines
Reverse engineering of binary programs for custom virtual machinesSmartDec
 
Whose Stack Is It Anyway?
Whose Stack Is It Anyway?Whose Stack Is It Anyway?
Whose Stack Is It Anyway?Ian Thomas
 
Performance tuning through iterations
Performance tuning through iterationsPerformance tuning through iterations
Performance tuning through iterationsGert Franz
 
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injectionStHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injectionStHack
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writerKyle Hailey
 
Project single cyclemips processor_verilog
Project single cyclemips processor_verilogProject single cyclemips processor_verilog
Project single cyclemips processor_verilogHarsha Yelisala
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeWim Godden
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql featuresConnor McDonald
 

Similaire à Profiling Oracle with GDB (20)

Profiling of Oracle Function Calls
Profiling of Oracle Function CallsProfiling of Oracle Function Calls
Profiling of Oracle Function Calls
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
 
Windows kernel debugging workshop in florida
Windows kernel debugging   workshop in floridaWindows kernel debugging   workshop in florida
Windows kernel debugging workshop in florida
 
Windows debugging sisimon
Windows debugging   sisimonWindows debugging   sisimon
Windows debugging sisimon
 
Hacklu11 Writeup
Hacklu11 WriteupHacklu11 Writeup
Hacklu11 Writeup
 
Understanding Performance with DTrace
Understanding Performance with DTraceUnderstanding Performance with DTrace
Understanding Performance with DTrace
 
Porting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPUPorting NetBSD to the open source LatticeMico32 CPU
Porting NetBSD to the open source LatticeMico32 CPU
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
Java bytecode Malware Analysis
Java bytecode Malware AnalysisJava bytecode Malware Analysis
Java bytecode Malware Analysis
 
Inside Winnyp
Inside WinnypInside Winnyp
Inside Winnyp
 
Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
 
Vertica trace
Vertica traceVertica trace
Vertica trace
 
Reverse engineering of binary programs for custom virtual machines
Reverse engineering of binary programs for custom virtual machinesReverse engineering of binary programs for custom virtual machines
Reverse engineering of binary programs for custom virtual machines
 
Whose Stack Is It Anyway?
Whose Stack Is It Anyway?Whose Stack Is It Anyway?
Whose Stack Is It Anyway?
 
Performance tuning through iterations
Performance tuning through iterationsPerformance tuning through iterations
Performance tuning through iterations
 
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injectionStHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writer
 
Project single cyclemips processor_verilog
Project single cyclemips processor_verilogProject single cyclemips processor_verilog
Project single cyclemips processor_verilog
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql features
 

Plus de Enkitec

Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsEnkitec
 
SQL Tuning Tools of the Trade
SQL Tuning Tools of the TradeSQL Tuning Tools of the Trade
SQL Tuning Tools of the TradeEnkitec
 
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityEnkitec
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceEnkitec
 
How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?Enkitec
 
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...Enkitec
 
Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)Enkitec
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writerEnkitec
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014Enkitec
 
Combining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityCombining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityEnkitec
 
Why You May Not Need Offloading
Why You May Not Need OffloadingWhy You May Not Need Offloading
Why You May Not Need OffloadingEnkitec
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXEnkitec
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXEnkitec
 
Colvin RMAN New Features
Colvin RMAN New FeaturesColvin RMAN New Features
Colvin RMAN New FeaturesEnkitec
 
Enkitec Exadata Human Factor
Enkitec Exadata Human FactorEnkitec Exadata Human Factor
Enkitec Exadata Human FactorEnkitec
 
About Multiblock Reads v4
About Multiblock Reads v4About Multiblock Reads v4
About Multiblock Reads v4Enkitec
 
Performance data visualization with r and tableau
Performance data visualization with r and tableauPerformance data visualization with r and tableau
Performance data visualization with r and tableauEnkitec
 
Epic Clarity Running on Exadata
Epic Clarity Running on ExadataEpic Clarity Running on Exadata
Epic Clarity Running on ExadataEnkitec
 
Sql tuning tools of the trade
Sql tuning tools of the tradeSql tuning tools of the trade
Sql tuning tools of the tradeEnkitec
 
SQLT XPLORE - The SQLT XPLAIN Hidden Child
SQLT XPLORE -  The SQLT XPLAIN Hidden ChildSQLT XPLORE -  The SQLT XPLAIN Hidden Child
SQLT XPLORE - The SQLT XPLAIN Hidden ChildEnkitec
 

Plus de Enkitec (20)

Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
SQL Tuning Tools of the Trade
SQL Tuning Tools of the TradeSQL Tuning Tools of the Trade
SQL Tuning Tools of the Trade
 
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
 
How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?How Many Ways Can I Manage Oracle GoldenGate?
How Many Ways Can I Manage Oracle GoldenGate?
 
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
Understanding how is that adaptive cursor sharing (acs) produces multiple opt...
 
Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)Sql tuning made easier with sqltxplain (sqlt)
Sql tuning made easier with sqltxplain (sqlt)
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writer
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
 
Combining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM StabilityCombining ACS Flexibility with SPM Stability
Combining ACS Flexibility with SPM Stability
 
Why You May Not Need Offloading
Why You May Not Need OffloadingWhy You May Not Need Offloading
Why You May Not Need Offloading
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEX
 
Colvin RMAN New Features
Colvin RMAN New FeaturesColvin RMAN New Features
Colvin RMAN New Features
 
Enkitec Exadata Human Factor
Enkitec Exadata Human FactorEnkitec Exadata Human Factor
Enkitec Exadata Human Factor
 
About Multiblock Reads v4
About Multiblock Reads v4About Multiblock Reads v4
About Multiblock Reads v4
 
Performance data visualization with r and tableau
Performance data visualization with r and tableauPerformance data visualization with r and tableau
Performance data visualization with r and tableau
 
Epic Clarity Running on Exadata
Epic Clarity Running on ExadataEpic Clarity Running on Exadata
Epic Clarity Running on Exadata
 
Sql tuning tools of the trade
Sql tuning tools of the tradeSql tuning tools of the trade
Sql tuning tools of the trade
 
SQLT XPLORE - The SQLT XPLAIN Hidden Child
SQLT XPLORE -  The SQLT XPLAIN Hidden ChildSQLT XPLORE -  The SQLT XPLAIN Hidden Child
SQLT XPLORE - The SQLT XPLAIN Hidden Child
 

Dernier

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Dernier (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Profiling Oracle with GDB

  • 1. ©2013  Enkitec   Profiling  Oracle  with  gdb   Hands  on!   • Frits  Hoogland   • Collaborate  2014,  Las  Vegas 1 This is the font size used for showing screen output. Be sure this is readable for you.
  • 2. `whoami` • Frits  Hoogland   • Working  with  Oracle  products  since  1996   ! • Blog:  hKp://fritshoogland.wordpress.com   • TwiKer:  @fritshoogland   • Email:  frits.hoogland@enkitec.com   • Oracle  ACE  Director   • OakTable  Member 2
  • 3. Goals  &  prerequisites   • Goal:  learn  aKendees  about  using  gdb  for   profiling  C  funcXon  sequences.   ! • Prerequisites:   – Understanding  of  (internal)  execuXon  of  C  programs.   – Understanding  of  Oracle  tracing  mechanisms. 3
  • 4. Copy  the  virtual  box  VM • The  virtual  box  importable  appliance  should  be   distributed  (USB  HDD/Thumbdrive)   ! • See  handout  for  virtual  machine/appliance   instrucXons  and  requirements. 4
  • 5. 1.  Tracing • In  order  to  troubleshoot  a  situaXon,  the  right   tool  needs  to  be  selected.   – Depending  on  that  outcome,  further  invesXgaXon  can   be  done,  possibly  at  different  layers  with  different   tools.   ! • The  most  logical  way  to  start  troubleshoot   Oracle  database  processing  is  using  the  wait   interface  and  database  staXsXcs. 5
  • 6. 1.  Tracing • Hands  on:   – logon  to  the  VM  as  oracle   – logon  to  Oracle:     rs ts/ts@//localhost/v11204! ! – trace  ‘select  count(*)  from  t2’:   select count(*) from t2; --this is prewarming the caching of the VM disk ! alter session set events ‘sql_trace level 8’; ! select count(*) from t2; ! alter session set events ‘sql_trace off’; 6
  • 7. 1.  Tracing • Copy  the  resulXng  trace  file  to  ~/1.trc   – When  looking  in  the  trace  file   • if  you’ve  got  a  fast  disk   • a  low  #  of  ‘direct  path  read’  waits  is  visible   ! – Look  at  waits  +  fetch  line  (p+cr) 7
  • 8. 1.  Tracing • What  is  happening?   • Obviously,  there  is  PIO  informaXon  missing.   ! • The  next  logical  step  is  to  include  system  call   (regular  IO  is  done  using  a  system  call)   informaXon  with  the  trace  informaXon. 8
  • 9. 1.  Tracing • This  is  done  using  the  linux  uXlity  ‘strace’.   ! • First  flush  the  buffer  cache:   sq! alter system flush buffer_cache;! ! • Then  start  a  sqlplus  session  to  trace:   rs ts/ts@//localhost/v11204! ! • Start  a  root  (shell)  session 9
  • 10. 1.  Tracing • Enable  sql_trace  at  level  8  in  the  sqlplus  session:   alter session set events ‘sql_trace level 8’! ! • Find  the  foreground  in  the  root  session:   ps -ef | grep [L]OCAL=NO! ! • And  strace  it  with  verbosity  on  the  write  call:   strace -e write=all -e all -p PID -o ~oracle/2.trc! ! • Start  a  root  (shell)  session. 10
  • 11. 1.  Tracing • Now  execute  the  count(*)  again  in  the  sqlplus   session.   select count(*) from t2;! ! • Aoer  the  count(*)  is  finised,  press  CTRL-­‐c  in  the   strace  session.   ! • And  exit  the  sqlplus  session.   exit 11
  • 12. 1.  Tracing • Now  open  the  strace  file  in  the  oracle  session:   less 2.trc! ! • And  skip  to  the  start  of  the  execuXon  of  the   count(*)  statement:   /count 12
  • 13. 1.  Tracing statfs("/u01/app/oracle/oradata/V11204/o1_mf_ts_9jvyr69l_.dbf", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=2162434, f_bfree=1108067, f_bavail=992458, f_files=558624, f_ffree=504033, f_fsid={-602411700, -1491991187}, f_namelen=255, f_frsize=4096}) = 0! open("/u01/app/oracle/oradata/V11204/o1_mf_ts_9jvyr69l_.dbf", O_RDWR|O_DSYNC| O_DIRECT) = 10! getrlimit(RLIMIT_NOFILE, {rlim_cur=64*1024, rlim_max=64*1024}) = 0! fcntl(10, F_DUPFD, 256) = 257! close(10) = 0! fcntl(257, F_SETFD, FD_CLOEXEC) = 0! fstatfs(257, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=2162434, f_bfree=1108067, f_bavail=992458, f_files=558624, f_ffree=504033, f_fsid={-602411700, -1491991187}, f_namelen=255, f_frsize=4096}) = 0! write(8, "WAIT #140425323829824: nam='Disk"..., 130) = 130! | 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |! | 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 44 69 73 6b 29824: n am='Disk |! | 00020 20 66 69 6c 65 20 6f 70 65 72 61 74 69 6f 6e 73 file op erations |! | 00030 20 49 2f 4f 27 20 65 6c 61 3d 20 38 34 39 20 46 I/O' el a= 849 F |! | 00040 69 6c 65 4f 70 65 72 61 74 69 6f 6e 3d 32 20 66 ileOpera tion=2 f |! | 00050 69 6c 65 6e 6f 3d 35 20 66 69 6c 65 74 79 70 65 ileno=5 filetype |! 13
  • 14. 1.  Tracing pread(257, "#24200202]@1P&6000142073100000000000000"..., 8192, 196100096) = 8192! write(8, "WAIT #140425323829824: nam='db f"..., 124) = 124! | 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |! | 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 62 20 66 29824: n am='db f |! | 00020 69 6c 65 20 73 65 71 75 65 6e 74 69 61 6c 20 72 ile sequ ential r |! | 00030 65 61 64 27 20 65 6c 61 3d 20 39 36 34 30 20 66 ead' ela = 9640 f |! | 00040 69 6c 65 23 3d 35 20 62 6c 6f 63 6b 23 3d 32 33 ile#=5 b lock#=23 |! | 00050 39 33 38 20 62 6c 6f 63 6b 73 3d 31 20 6f 62 6a 938 bloc ks=1 obj |! | 00060 23 3d 32 30 30 34 35 20 74 69 6d 3d 31 33 39 32 #=20045 tim=1392 |! | 00070 38 39 37 31 39 34 37 31 33 30 33 31 89719471 3031 |! | 00080 38 36 86 | 14
  • 15. 1.  Tracing mmap(NULL,524288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_NORESERVE,6,0x6d000) = 0x7fb7516c2000! mmap(0x7fb7516c2000,65536,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,6, 0) = 0x7fb7516c2000! mmap(NULL,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_NORESERVE,6,0xed000) = 0x7fb7515b2000! mmap(0x7fb7515b2000,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,6,0) = 0x7fb7515b2000! io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1! mmap(NULL,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_NORESERVE,6,0x1fd000)= 0x7fb7514a2000! mmap(0x7fb7514a2000,1114112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,6,0) = 0x7fb7514a2000! io_submit(140425370206208, 1, {{0x7fb7516c4bc0, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,1,128,{{0x7fb7516c45e8,0x7fb7516c45e8,106496,0}}, {600, 0}) = 1! write(8, "WAIT #140425323829824: nam='dire"..., 130) = 130! | 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |! | 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 69 72 65 29824: n am='dire |! | 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |! | 00030 61 3d 20 31 31 30 31 20 66 69 6c 65 20 6e 75 6d a= 1101 file num |! | 00040 62 65 72 3d 35 20 66 69 72 73 74 20 64 62 61 3d ber=5 fi rst dba= |! | 00050 32 33 39 33 39 20 62 6c 6f 63 6b 20 63 6e 74 3d 23939 bl ock cnt= |! | 00060 31 33 20 6f 62 6a 23 3d 32 30 30 34 35 20 74 69 13 obj#= 20045 ti |! | 00070 6d 3d 31 33 39 32 38 39 37 31 39 34 37 31 35 35 m=139289 71947155 |! | 00080 35 33 53 | 15
  • 16. 1.  Tracing • So,  it  looks  like  when  IOs  are  reaped*,  Oracle   registers  a  wait.   ! • But  that  isn’t  consistent  with  the  low  number   of  ‘direct  path  read’  waits…   ! • Let’s  look  further  in  2.trc  to  the  AIO  calls: 16
  • 17. 1.  Tracing io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,2,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {0, 0}) = 1! io_submit(140425370206208, 1, {{0x7fb7516c4bc0, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,2,128,{{0x7fb7516c45e8,0x7fb7516c45e8,1032192, 0}}, {0, 0}) = 1! io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,1,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {600,0}) = 1! write(8, "WAIT #140425323829824: nam='dire"..., 130) = 130! | 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |! | 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 69 72 65 29824: n am='dire |! | 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |! | 00030 61 3d 20 36 30 35 20 66 69 6c 65 20 6e 75 6d 62 a= 605 f ile numb |! | 00040 65 72 3d 35 20 66 69 72 73 74 20 64 62 61 3d 32 er=5 fir st dba=2 |! | 00050 35 34 37 34 20 62 6c 6f 63 6b 20 63 6e 74 3d 31 5474 blo ck cnt=1 |! | 00060 32 36 20 6f 62 6a 23 3d 32 30 30 34 35 20 74 69 26 obj#= 20045 ti |! | 00070 6d 3d 31 33 39 32 38 39 37 31 39 34 37 34 32 36 m=139289 71947426 |! | 00080 38 31 81 | 17
  • 18. 1.  Tracing • Okay,  for  some  reason:   • some  reaped  IOs  do  result  in  a  wait  line,   • and  some  other’s  do  not.   ! • We  can  safely  assume  it  has  to  do  with  the  IO   speed,  but  how  is  the  decision  made? 18
  • 19. 1.  Tracing • In  order  to  find  out,  we  need  to  look  at  the   sequence  of  funcXon  calls  in(side)  the  database.   This  is  done  using  gdb.   ! • Create  a  root  (shell)  session  for  gdb,  and  an   oracle  (shell)  session  for  sqlplus  (rs  ts/ts@// localhost/v11204). 19
  • 20. 1.  Tracing • In  the  root  session   • grep  the  PID  of  the  foreground  session:   ps -ef | grep [L]OCAL=NO! ! • AKach  to  the  session  with  gdb:   gdb -p PID! ! • Enter  the  commands  on  the  next  slide  in  gdb: 20
  • 21. 1.  Tracing set pagination off! set logging file /home/oracle/3.trc! set logging on! break io_submit! break 'io_getevents@plt'! rbreak ^kslwt[be]ctx! commands 1-4! c! end 21
  • 22. 1.  Tracing • This  has  set  4  breakpoints  in  gdb:   ! (gdb) info break! Num Type Disp Enb Address What! 1 breakpoint keep y 0x00007fcaa5083660 <io_submit>! c! 2 breakpoint keep y 0x00000000009e5b58 <io_getevents@plt>! c! 3 breakpoint keep y 0x0000000008c18680 <kslwtbctx+4>! c! 4 breakpoint keep y 0x0000000008c1f92c <kslwtectx+4>! c 22
  • 23. 1.  Tracing • In  gdb,  issue  ‘c’  to  conXnue  the  foreground   session:   ! • In  sqlplus,  execute:   select count(*) from t2; 23
  • 24. 1.  Tracing • Once  the  select  count(*)  is  ready:   • Stop  gdb  (CTRL-­‐c,  q)   • Exit  sqlplus,  and  read  3.trc  using  less:   less 3.trc 24
  • 25. 1.  Tracing Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! ! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! ! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! ! Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1! ! Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1! ! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! ! Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1! ! Breakpoint 1, 0x00007fa883926660 in io_submit () from /lib64/libaio.so.1! ! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt () 25
  • 26. 1.  Tracing • This  shows:     • Oracle  ending  the  Xming  of  a  wait  (kslwtectx())   • Then  another  wait  is  encountered  (kslwtbctx()-­‐ kslwtectx())   • Then  IOs  are  submiKed  (io_submit())  and  IOs   are  reaped  (io_getevents())   • In  this  example:  without  a  wait  event! 26
  • 27. 1.  Tracing • In  my  case,  I  didn’t  get  a  single  wait   accompanying  IO  (io_submit()-­‐io_getevents())   because  I  turned  virtual  box  disk  caching  on.   ! • Let’s  slow  the  IOs  down  to  get  the  ‘direct  path   read’  waits  back. 27
  • 28. 1.  Tracing • Startup  a  sqlplus  session  again  (as  oracle).   rs ts/ts@//localhost/v11204! ! • (as  root)  Now  setup  IO  throKling  using  cgroups:   mkdir -p /cgroup/blkio! mount -t cgroup -o blkio none /cgroup/blkio! cgcreate -g blkio:/iothrottle! cgset -r blkio.throttle.read_iops_device="8:0 1" iothrottle 28
  • 29. 1.  Tracing • Find  the  PID  of  the  server  process:   ps -ef | grep [L]OCAL=NO! ! • And  throKle  the  Oracle  process:   echo PID > /cgroup/blkio/iothrottle/tasks! ! • Enter  gdb  again,  and  setup  the  breakpoints   gdb -p PID 29
  • 30. 1.  Tracing set pagination off! set logging file /home/oracle/4.trc! set logging on! break io_submit! break 'io_getevents@plt'! rbreak ^kslwt[be]ctx! commands 1-4! c! end 30
  • 31. 1.  Tracing • Make  the  server  session  runnable  again  in  gdb   by  execuXng  ‘c’  for  conXnue.   • Now  run  the  query  again:   select count(*) from t2;! ! • Once  the  query  is  finished,  quit  gdb  again  (CTRL-­‐ c  and  q),  quit  sqlplus,  and  look  in  4.trc  with  less. 31
  • 32. 1.  Tracing Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1! Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx () 32
  • 33. 1.  Tracing • This  is  the  end  of  chapter  1.   • In  this  chapter  you  have  learned:   • How  to  start  a  sql_trace   • How  to  combine  strace  with  sql_trace   • How  to  use  gdb  to  break  and  conXnue  on  C   funcXons,  in  order  to  profile. 33
  • 34. 2.  strace • strace  shows  (only)  system  calls.   • This  means  calls  which  require  kernel   interacXon  from  the  user  land  process.   • Things  like:  disk  I/O,  network  I/O,  allocaXon   and  release  of  memory,  IPC,  etc.   ! • Normal  data  processing  in  Oracle  happens  in   “userland”,  thus  is  not  visible  with  strace. 34
  • 35. 2.  strace • The  combinaXon  of  strace  +  sql_trace  is   powerful,  and  gives  more  insight.   • In  our  example,  it  shows  some  I/Os  indeed  are   not  instrumented.   ! • strace  shows  the  result  of  the  system  call  (!)   • This  means  it  shows  the  return  code  of  the   call. 35
  • 36. io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,2,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {0, 0}) = 1! io_submit(140425370206208, 1, {{0x7fb7516c4bc0, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,2,128,{{0x7fb7516c45e8,0x7fb7516c45e8,1032192, 0}}, {0, 0}) = 1! io_submit(140425370206208, 1, {{0x7fb7516c45e8, 0, 0, 0, 257}}) = 1! io_getevents(140425370206208,1,128,{{0x7fb7516c4bc0,0x7fb7516c4bc0,1032192,0}}, {600,0}) = 1! write(8, "WAIT #140425323829824: nam='dire"..., 130) = 130! | 00000 57 41 49 54 20 23 31 34 30 34 32 35 33 32 33 38 WAIT #14 04253238 |! | 00010 32 39 38 32 34 3a 20 6e 61 6d 3d 27 64 69 72 65 29824: n am='dire |! | 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |! | 00030 61 3d 20 36 30 35 20 66 69 6c 65 20 6e 75 6d 62 a= 605 f ile numb |! | 00040 65 72 3d 35 20 66 69 72 73 74 20 64 62 61 3d 32 er=5 fir st dba=2 |! | 00050 35 34 37 34 20 62 6c 6f 63 6b 20 63 6e 74 3d 31 5474 blo ck cnt=1 |! | 00060 32 36 20 6f 62 6a 23 3d 32 30 30 34 35 20 74 69 26 obj#= 20045 ti |! | 00070 6d 3d 31 33 39 32 38 39 37 31 39 34 37 34 32 36 m=139289 71947426 |! | 00080 38 31 81 | strace  -­‐  IOs  with  no  event 36
  • 37. 2.  strace • A  lesser  known  ‘feature’  of  strace  is  it  can  leave   out  system  calls.   • This  is  how  a  sql_trace  at  level  8  plus  strace   looks  like  on  an  IO  thro(led  process 37
  • 38. 2.  strace • strace  does  not  leave  out  system  calls!   • There  is  a  shortcut/opXmisaXon  in  libaio  to   prevent  the  call  io_getevents  from  becoming  a   system  call.   • This  is  possible  because  the  IO  results  are   available  in  userspace.   • Want  to  know  more  about  this?  See:  hKp:// fritshoogland.wordpress.com/2014/03/11/ linux-­‐strace-­‐doesnt-­‐lie-­‐aoer-­‐all/ 38
  • 39. io_submit(140691720466432, 1, {{0x7ff55522de00, 0, 0, 0, 257}}) = 1! io_getevents(140691720466432, 1, 128, {{0x7ff55522e3d8, 0x7ff55522e3d8, 1032192, 0}}, {600, 0}) = 1! times({tms_utime=7, tms_stime=6, tms_cutime=0, tms_cstime=0}) = 430581853! write(8, "n*** 2014-02-21 13:44:15.163n", 29) = 29! | 00000 0a 2a 2a 2a 20 32 30 31 34 2d 30 32 2d 32 31 20 .*** 201 4-02-21 |! | 00010 31 33 3a 34 34 3a 31 35 2e 31 36 33 0a 13:44:15 .163. |! lseek(8, 0, SEEK_CUR) = 5276! write(8, "WAIT #140691674130488: nam='dire"..., 134) = 134! | 00000 57 41 49 54 20 23 31 34 30 36 39 31 36 37 34 31 WAIT #14 06916741 |! | 00010 33 30 34 38 38 3a 20 6e 61 6d 3d 27 64 69 72 65 30488: n am='dire |! | 00020 63 74 20 70 61 74 68 20 72 65 61 64 27 20 65 6c ct path read' el |! | 00030 61 3d 20 31 39 39 37 39 37 36 20 66 69 6c 65 20 a= 19979 76 file |! | 00040 6e 75 6d 62 65 72 3d 35 20 66 69 72 73 74 20 64 number=5 first d |! | 00050 62 61 3d 32 35 30 39 30 20 62 6c 6f 63 6b 20 63 ba=25090 block c |! | 00060 6e 74 3d 31 32 36 20 6f 62 6a 23 3d 32 30 30 34 nt=126 o bj#=2004 |! | 00070 35 20 74 69 6d 3d 31 33 39 32 39 38 36 36 35 35 5 tim=13 92986655 |! | 00080 31 36 33 33 39 31 163391 | 2.  strace 39
  • 40. 2.  strace • This  is  how  it  looks  like  when  the  same  is  done   using  gdb: 40
  • 41. 2.  strace Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1! Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx ()! Breakpoint 1, 0x00007f40a05c3660 in io_submit () from /lib64/libaio.so.1! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 4, 0x0000000007cf47b6 in kslwtbctx ()! Breakpoint 2, 0x000000000082d7d8 in io_getevents@plt ()! Breakpoint 5, 0x0000000007cfb4f2 in kslwtectx () 41
  • 42. 2.  strace • With  strace,  we  see:   • single  io_submit()   • followed  by  a  single  io_getevents()   ! • With  gdb,  we  see:   • single  io_submit()   • followed  by  3  io_getevents()  calls. 42
  • 43. 2.  strace • IMPORTANT!   – With  strace,  system  calls  are  shown.   – With  write  output,  we  see  the  Oracle  wait  events   – When  waits  follow  a  system  call  or  system  calls,  we   can  assume  the  wait  is  Xming  of  that.   ! • There  is  no  way  to  tell  what  the  wait  did  actually   Xme!! 43
  • 44. 2.  strace • This  is  the  end  of  chapter  2.   • In  this  chapter  you  have  learned:   • What  strace  does.   • What  limitaXon  strace  has  (no  user  land).   • That  strace  can’t  tell  you  what  a  wait  event   actually  did  Xme.   • That  it  can  leave  out  system  calls. 44
  • 45. 3.  gdb  theory • gdb  is  the  GNU  debugger.   • hKp://www.sourceware.org/gdb/   • DescripXon  from  the  website:   ! GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act: • Start your program, specifying anything that might affect its behavior. • Make your program stop on specified conditions. • Examine what has happened, when your program has stopped. • Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another. ! The program being debugged can be written in Ada, C, C++, Objective-C, Pascal (and many other languages). Those programs might be executing on the same machine as GDB (native) or on another machine (remote). GDB can run on most popular UNIX and Microsoft Windows variants. ! 45
  • 46. 3.  gdb  theory • For  profiling,  we  use  the  ‘make  your  program   stop  on  specified  condiXons’.   • However,  we  just  use  the  stop  noXficaXon,  and   make  the  process  conXnue.     ! • To  make  full  use  of  the  gdb  funcXonality,  the   executable  needs  to  be  compiled  with  the  ‘-­‐g’   flag  to  include  debug  informaXon. 46
  • 47. 3.  gdb  theory • By  default,  executables  do  not  have  debug   informaXon  added.   ! • Debug  informaXon  makes  it  able  to  relate  C-­‐code   lines  to  steps  of  execuXon  of  the  executable.   ! • As  you  might  expect  at  this  point:  Oracle  doesn’t   include  this  informaXon. 47
  • 48. 3.  gdb  theory • So…why  talk  about  gdb  and  Oracle  then?   • Of  course  we  sXll  can  use  it,  that  is  what  this   talk  about.   ! • Oracle  on  linux  is  an  ‘ELF’  executable.   ! [oracle@ol65vm [v11204] bin]$ file oracle! oracle: setuid setgid ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped 48
  • 49. 3.  gdb  theory • It  says  ‘not  stripped’   • Which  means  funcXon  symbolic  informaXon  is   NOT  removed.   ! • It  is  dynamically  linked!   • An  executable  has  to  symbolically  call   funcXons  in  a  library. 49
  • 50. 3.  gdb  theory • Check  on  dynamically  loaded  libraries  with  ‘ldd’:   ! [oracle@ol65vm [v11204] bin]$ ldd oracle! ! linux-vdso.so.1 => (0x00007fffc0dfe000)! ! libodm11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libodm11.so (0x00007fdb6d75e000)! ! libcell11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libcell11.so (0x00007fdb6d5fa000)! ! libskgxp11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxp11.so (0x00007fdb6d424000)! ! libaio.so.1 => /lib64/libaio.so.1 (0x00007fdb6bcea000)! ! libdl.so.2 => /lib64/libdl.so.2 (0x00007fdb6bae5000)! ! libm.so.6 => /lib64/libm.so.6 (0x00007fdb6b861000)! ! libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdb6b644000)! ! libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fdb6b42a000)! ! libc.so.6 => /lib64/libc.so.6 (0x00007fdb6b096000)! ! /lib64/ld-linux-x86-64.so.2 (0x00007fdb6d861000)! (partial listing) 50
  • 51. 3.  gdb  theory • In  order  to  call  a  funcXon  in  a  library,  it  needs  to  be   defined  somewhere  in  the  executable:   • Procedure  Linkage  Table  (plt).   • Libraries  and  funcXons  are  lazy  loaded.   ! [oracle@ol65vm [v11204] bin]$ readelf -a oracle | grep io_getevents! 00000b5de698 00fc00000007 R_X86_64_JUMP_SLO 0000000000000000 io_getevents + 0! 252: 0000000000000000 0 FUNC WEAK DEFAULT UND io_getevents@LIBAIO_0.4 (11)! 633326: 0000000000000000 0 FUNC WEAK DEFAULT UND io_getevents@@LIBAIO_0.4 51
  • 52. 3.  gdb  theory • The  reason  for  showing  the  plt:   ! • The  funcXons  in  a  dynamically  linked   executable  can  only  be  called  by  name.   ! • So  the  library  is  free  to  have  the  funcXon  at   any  offset. 52
  • 53. 3.  gdb  theory • FuncXons  in  an  executable  can  be  found  using   ‘nm’,  if  it’s  not  stripped:   ! [oracle@ol65vm [v11204] bin]$ nm -a oracle | grep kslwtbctx$! 0000000008c1867c T kslwtbctx! 53
  • 54. 3.  gdb  theory • Again:  I  don’t  suspect  Oracle  to  ever  release  the   debug  symbols  for  the  Oracle  executable.   • Because  it  would  reveal  source  code.   • This  also  means  that  gdb  does  not  understand   the  funcXon  call  arguments.   ! • But  Linux  is  open  source! 54
  • 55. 3.  gdb  theory • Oracle  linux  has  a  complete  repository  with  the   operaXng  system  and  uXliXes  compiled  with   debug  symbols:  the  debug  info  packages.   • hKps://oss.oracle.com/ol6/debuginfo   ! • For  the  sake  of  this  course,  I  created  a  directory   ~root/debuginfo_rpms  in  which  the  relevant   debuginfo  rpms  are  put.   55
  • 56. 3.  gdb  theory • Install  the  debug  info  packages  from  that   directory:   [oracle@ol65vm [] ~]$ su -! Password: ! [root@ol65vm ~]# cd ~/debuginfo_rpms/! [root@ol65vm debuginfo_rpms]# yum localinstall *! Setting up Local Package Process! Examining glibc-debuginfo-2.12-1.132.el6.x86_64.rpm: glibc- debuginfo-2.12-1.132.el6.x86_64! …! Total size: 54 M! Installed size: 54 M! Is this ok [y/N]: y! … 56
  • 57. 3.  gdb  theory • Verify  the  installed  debug  info  packages:   [root@ol65vm debuginfo_rpms]# rpm -qa | grep debuginfo! ! glibc-debuginfo-common-2.12-1.132.el6.x86_64! libaio-debuginfo-0.3.107-10.el6.x86_64! glibc-debuginfo-2.12-1.132.el6.x86_64 57
  • 58. 3.  gdb  theory • Now  let’s  setup  a  normal  database  connecXon   again:   [oracle@ol65vm [v11204] bin]$ rs ts/ts@//localhost/v11204! ! • Find  the  PID  of  the  server  process  in  a  root   session,  and  aKach  to  it  with  gdb  again:   [root@ol6vm ~]# ps -ef | grep [L]OCAL=NO! oracle 2657 1 0 02:22 ? 00:00:00 oraclev11204 (LOCAL=NO)! [root@ol6vm ~]# gdb -p 2657 58
  • 59. 3.  gdb  theory • Enter  the  following  in  the  gdb  session:   set pagination off! break io_submit! break io_getevents_0_4! c! ! • This  makes  the  sqlplus  session  runnable  again.   select count(*) from t2; 59
  • 60. 3.  gdb  theory • Because  we  didn’t  specify  conXnue  as  acXon   with  a  break,  gdb  breaks  execuXon.   • Look  what  gdb  tells  you  with  io_submit():   Breakpoint 1, io_submit (ctx=0x7ff8b626c000, nr=1, iocbs=0x7fffa5c31a80) at io_submit.c:23! 23!io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr, struct iocb **, iocbs)! • conXnue  unXl  you  get  a  io_getevents():   Breakpoint 2, io_getevents_0_4 (ctx=0x7ff8b626c000, min_nr=2, nr=128, events=0x7fffa5c37b68, timeout=0x7fffa5c38b70) at io_getevents.c:46! 46!! if (ring==NULL || ring->magic != AIO_RING_MAGIC) 60
  • 61. 3.  gdb  theory • Using  the  debug  info  package,  gdb  can  interpret   system  calls  arguments  for  which  the  debug   informaXon  has  been  installed!   • This  allows  you  to  see  quite  a  lot.   ! • Important:  gdb  breaks  if  the  funcXon  is  entered.   This  means  we  can  not  read  the  return  code  of   the  funcXon  we  are  breaking  on!   • io_getevents()  returns  ready  IOs. 61
  • 62. 3.  gdb  theory • Quit  the  gdb  (root)  session  (q).   • Quit  the  sqlplus  (oracle)  session.   ! • In  the  oracle  session:   cd ~/gdb_macros! sq! @create_pw! @create_pl! exit 62
  • 63. 3.  gdb  theory • Now  setup  a  normal  oracle  connecXon  again:   rs ts/ts@//localhost/v11204! ! • And  setup  a  gdb  session  from  ~oracle/ gdb_macros  and  aKach  to  the  oracle  session:   cd ~oracle/gdb_macros! ps -ef | grep [L]OCAL=NO! gdb -p PID 63
  • 64. 3.  gdb  theory • Now  use  some  already  prepared  gdb  macros:   source pstruct.gdb! source paio.gdb! source pw.gdb! c! ! • And  start  ‘select  count(*)  from  t2;’  from  the   sqlplus  session. 64
  • 65. 3.  gdb  theory • Now  look  what  is  visible  with  the  three  gdb   macros:   kslwtectx -- Previous wait time: 74621038: SQL*Net message from client! opiosq0 -- parse! kksfbc -- V$SQL.ADDRESS: 78d7a6d8! opiexe -- execute! kslwtbctx! kslwtectx -- Previous wait time: 1195: SQL*Net message to client! opifch2 -- fetch! kslwtbctx! io_submit - 1,58f5c000 - nr,ctx! fd: 256, nbytes: 1! io_getevents - 1,58f5c000 - minnr,ctx,timeout: $1 = {tv_sec = 10, tv_nsec = 0}! kslwtectx -- Previous wait time: 70121: Disk file operations I/O! 65
  • 66. 3.  gdb  theory • This  explains  the  direct  path  read  waits:   • This  is  done  with  cgroups  IO  throKling   opifch2 -- fetch! io_submit - 1,58f5c000 - nr,ctx! fd: 256, nbytes: 106496! io_submit - 1,58f5c000 - nr,ctx! fd: 256, nbytes: 122880! io_getevents - 2,58f5c000 - minnr,ctx,timeout: $1 = {tv_sec = 0, tv_nsec = 0}! io_getevents - 2,58f5c000 - minnr,ctx,timeout: $2 = {tv_sec = 0, tv_nsec = 0}! kslwtbctx! io_getevents - 1,58f5c000 - minnr,ctx,timeout: $3 = {tv_sec = 600, tv_nsec = 0}! kslwtectx -- Previous wait time: 946495: direct path read 66
  • 67. 3.  gdb  theory • This  is  the  end  of  chapter  3.   • In  this  chapter  you  have  learned:   • What  gdb  is.   • What  debug  symbols  are  and  how  to  get   them.   • What  stripped  and  not  stripped  means.   • oracle  as  dynamically  linked  executable.   • procedure  linkage  table  and  finding  funcXons   • how  to  break  on  funcXons 67
  • 68. 3.  gdb  theory • The  breaking  in  gdb  happens  on  entering  a   funcXon  call.   • The  existence  of  gdb  macro’s  created  by   Enkitec  to  obtain  more  informaXon. 68
  • 69. 4.  gdb  lab • What  does  the  wait  event  ‘direct  path  read’  mean   • Enable  synchronous  IO  for  the  database  now.   • filesystemio_opXons=‘none’   • Now  trace  the  ‘select  count(*)  from  t2’  again   with  gdb.   • What  wait  event  indicates  IO  now?  What  does   the  wait  event  Xme?   • Turn  on  asynchronous  IO  again  when  finished. 69
  • 70. 4.  gdb  lab • What  does  asynchronous  IO  mean  for  IO  calls?   • Synchronous  IO  is  done  with  the  pread()  call.   • Asynchronous  IO  is  done  with  the  calls   io_submit()  and  io_getevents().   • Flush  the  buffer  cache.   • Trace  the  ‘select  count(*)  from  t2’  with  gdb.   • What  IO  calls  are  done? 70
  • 71. 4.  gdb  lab • What  does  SIO  mean  for  the  dbwr  wait  events?   • Enable  synchronous  IO  for  the  database  now.   • filesystemio_opXons=‘none’   • The  dbwr  has  a  disXnct  write  wait  event.   • Trace  the  dbwr  (set  db_writer_processes  to  1  if   there  are  mulXple)  with  gdb.   • Create  a  table,  insert  a  row,  commit  and  issue   ‘alter  system  checkpoint’.   • Turn  on  asynchronous  IO  again  when  finished. 71
  • 72. 5.  Extra • How  to  find  funcXon  names?   – perf   • Show  how  some  of  the  gdb  macro’s  are  made.   • Explain  using  registers  to  find  funcXon  call   arguments. 72