SlideShare ist ein Scribd-Unternehmen logo
1 von 47
IO Waits


           Kyle Hailey
Kyle.hailey@embarcadero.com
   http://oraclemonitor.com
Waits Covered in this Section

  1.    db file sequential read
  2.    db file scattered read                     Buffer Cache I/O
  3.    db file parallel read
  4.    read by other session
  5.    direct path read
  6.    direct path write
  7.    direct path read temp
  8.    direct path write temp                           PGA I/O
  9.    direct path write (lob)
  10.   Local write wait
  11.   data file init write                       Special Cases




                            Copyright 2006 Kyle Hailey
IO Waits
                  SGA
        Log      Library            Buffer
        Buffer   Cache              Cache


User1                                           DBWR




             Data Files
                   Copyright 2006 Kyle Hailey
Standard Table/Index IO


   1. db file sequential read
         Single block read

   1. db file scattered read
         Multi block read

   1. db file parallel read
         Non-contiguous multi block read

   1. read by other session
         Wait for another session to do the io




                               Copyright 2006 Kyle Hailey
db file sequential read
Buffer Cache    The top wait
                Single Block Read
                  Data via Index and/or Rowid
                  Rollback (if expecting FTS => problem)

                Select **from emp where empno = 9999;
                Select from emp where empno = 9999;
   Shadow            Index on emp.empno
   Process

                1)    Search Buffer Cache for
                      the block by rowid
                2)    Fails                              Note: “sequential” means
                3)    Reads of disk                         A sequence like a
                      •     File                            rowid
                      •     Block

                            Copyright 2006 Kyle Hailey
db file scattered read
                     Multi Block Read
Buffer Cache            FullTable Scan
                        Index Fast Full Scans


               SQL> select * from emp;
               SQL> select * from emp;
  Shadow
  Process
               1)    Search Buffer Cache for the
                     blocks                                Note: Scattered Means
               2)    Fails
                                                              Blocks are read and
               3)    Reads off disk
                     •     File                               scattered throughout
                     •     Block                              buffer cache
                     •     Multi Block Read Count

                          db_file_multiblock_read_count
                              Copyright 2006 Kyle Hailey
db file parallel read

Buffer Cache    Process issues multiple single block reads in parallel
                   Documentation says only for recovery
                   But seems to happen for normal read ops
                   Async Call – wait for all reads to complete

                Examples
                   Not contiguous multi block read
                   Index full or range scan
    Shadow
                   Where values in            Select **from emp where
    Process                                     Select from emp where
                                                       Empno in (1,2,3,4,5,6);
                                                       Empno in (1,2,3,4,5,6);

                    1) Search Buffer Cache for
                       the blocks
                    2) Fails
                    3) Reads that block off Disk
                          Copyright 2006 Kyle Hailey
Read by other Session
Buffer Cache

                    Multiple sessions reading the
                    same data that requires IO
                    Ex) two users doing a full table
                    scan at the same time


   S1     S2
               1.    Block not found in cache
               2.    Read block from disk
               3.    Found other session already
                     reading block from disk
               4.    Wait for the other session to finish
                     IO

                       Copyright 2006 Kyle Hailey
IO – Further Investigation
select parameter1, parameter2, parameter3 from v$event_name


NAME                        P1                          P2         P3
read by   other session               file#          block#   class#
db file   sequential read             file#          block#   blocks
db file   scattered read              file#          block#   blocks
db file   parallel read               files          blocks   requests



  P1 and P2 are file# , block#
  We can use P1, P2, P3 from ASH to get more info

  Exception:
  db file parallel read – p1,p2,p3 not useful
                        Copyright 2006 Kyle Hailey
sequential reads – blocks read
select
       event,
       ash.p3,
       o.object_name objn,
       o.object_type otype,
       CURRENT_FILE# filen,
       CURRENT_BLOCK# blockn,
       ash.SQL_ID
from v$active_session_history ash,
         all_objects o
where event like 'db file sequential read'
   and o.object_id (+)= ash.CURRENT_OBJ#
order by sample_time;                    P3= # of
                                                                               blocks
 EVENT                     P3 OBJN                                OTYPE FILEN BLOCKN SQL_ID
 db file sequential read   1 49890 MGMT_METRICS_1HOUR_ INDEX               3   41737
 db file sequential read   1 50908 MGMT_DB_SGA_ECM     TABLE               3   28489 35at43xqj7bs0
 db file sequential read   1 55303 TOTO                TABLE               1   60218 7xftj55rvjw9s


                                     Copyright 2006 Kyle Hailey
scattered reads – multi blocks read

  select
         event,
         ash.p3,
         o.object_name objn,
         o.object_type otype,
         CURRENT_FILE# filen,
         CURRENT_BLOCK# blockn,
         ash.SQL_ID
  from v$active_session_history ash,
        all_objects o
  where event like 'db file scattered read'
     and o.object_id (+)= ash.CURRENT_OBJ# P3= # of
  order by sample_time;                     blocks
   EVENT                    P3 OBJN                                OTYPE FILEN BLOCKN SQL_ID
   db file scattered read   8 9078 WRH$_SYSMETRIC_HISTO TABLE               3   52363
   db file scattered read   5 8781 WRI$_ALERT_HISTORY   TABLE               3    2676
   db file scattered read   8 57 OBJAUTH$               TABLE               1   33993 3t2mk1prj24hu


                                      Copyright 2006 Kyle Hailey
IO by File
select io.cnt,
           round(io.cnt/(&v_minutes*60),2) aas,
           io.event,
           io.p1 p1,
           f.tablespace_name
from ( select
               count(*) cnt,
               substr(event,0,25) event,
               ash.p1 p1
           from v$active_session_history ash
           where ( event like 'db file s%' or event like 'direct%' )
               and sample_time > sysdate - &v_minutes/(60*24)
           group by
               event ,
               ash.p1
       ) io,
       dba_data_files f    CNT AAS EVENT                   P1 TABLESPACE
where                        1 .00 db file sequential read   1 SYSTEM
      f.file_id = io.p1      2 .00 db file sequential read   3 SYSAUX
Order by io.cnt ;           38 .06 db file sequential read   6 SOE
                           179 .30 db file sequential read   7 SOEINDEX
IO by Object
select
     count(*) cnt,
     CURRENT_OBJ#||' '||o.object_name objn,
     o.object_type otype
from v$active_session_history ash,
    all_objects o
where ( event like 'db file s%' or event like 'direct%' )
  and o.object_id (+)= ash.CURRENT_OBJ#
  and sample_time > sysdate - &1/(60*24)
  and session_state='WAITING'
group by
     CURRENT_OBJ#, o.object_name ,
     o.object_type
Order by count(*)

                CNT            AAS OBJN                           OTYPE

              PARTITION.00
                79                    52949 ORDER_ITEMS           TABLE
                97     .00            -1
               130     .00            53117       ORD_STATUS_IX   INDEX
               498     .01            53120       CUST_EMAIL_IX   INDEX
               512     .01            0
              1632     .03            53112       ITEM_ORDER_IX   INDEX
IO by SQL
select
       round(sum(cnt) over ( partition by io.sql_id order by sql_id ) / (&v_minutes*60),2) aas,
       io.sql_id,
       io.cnt cnt,
       100*cnt/sum(cnt) over ( partition by io.sql_id order by sql_id ) pct,
       o.object_name obj,
       o.subobject_name sub_obj,
       o.object_type otype,
       substr(io.event,8,10) event,
                                            AAS SQL_ID                                      % OBJ             TABLESPACE
       io.p1 file#,                        ----- -------------                             --- --------------- ----------
       f.tablespace_name tablespace_name,
       tbs.contents                          .18 0yas01u2p9ch4                               6 ITEM_PRODUCT_IX SOEINDEX
from
(
                                                                                             6 ORDER_ITEMS_UK  SOEINDEX
  select                                                                                    88 ITEM_ORDER_IX   SOEINDEX
        sql_id,
                     event,
                                               .32 6v6gm0fd1rgrz                             6 WAIT_OBJECTS    SYSTEM
        count(*) cnt,                                                                       94 UNDO            UNDOTBS1
        count(*) / (&v_minutes*60) aas,
        CURRENT_OBJ# ,
        ash.p1
   from v$active_session_history ash
   where ( event like 'db file s%' or event like 'direct%' )
      and sample_time > sysdate - &v_minutes/(60*24)
   group by
       CURRENT_OBJ#,
       event,
       ash.p1,
       sql_id
) io,
   dba_data_files f
   ,all_objects o
   , dba_tablespaces tbs
where
   f.file_id = io.p1
   and o.object_id (+)= io.CURRENT_OBJ#
   and tbs.tablespace_name= f.tablespace_name
Order by tcnt, sql_id, cnt
/
Missing Object IDs
 dba_extents – get object name
         select segment_name,
          select segment_name,
                 segment_type
                  segment_type
         from dba_extents
          from dba_extents
         where file_id = P1
          where file_id = P1
             and P2 between
              and P2 between
            block_id and block_id + blocks – 1;
             block_id and block_id + blocks – 1;
 Dba_extents is notoriously slow
 Options
   Create    a table as select – use table
       recreate as object extents change
   Catch    blocks in x$bh when waits occur

                           Copyright 2006 Kyle Hailey
Copy of dba_extents
Enter value for file: 3
Enter value for block: 6619
OWNER          SEGMENT_NAME              SEGMENT_TYPE
WMSYS            LOG_TAB_PK              INDEX

Elapsed: 00:00:41.25

create table myextents as select * from dba_extents
Table created.

Elapsed: 00:01:25.73


CNT   OWN SEGMENT_NAME    SEGMENT_TYPE
  11 SYS   SMON_SCN_TO_TIME CLUSTER
 993 SYS   _SYSSMU7$        TYPE2 UNDO
150 rows   selected.

Elapsed: 00:00:01.03
IO Solutions


 1. Check average read times per file
       Should be between 5-20 ms
       Data in Statspack under “File IO Stats”
 1. Check Cache buffer Hit ratio
       Check db_cache_advice 9i and higher
       Data in Statspack under “Buffer Pool Advisory”
       Want to optimize data caching
 1. Tune High IO SQL
       Check reads off of UNDO

                       Copyright 2006 Kyle Hailey
Step 1a: Ave Read Time
File IO Stats DB/Inst:labsf03 Snaps: 1-2
 File IO Stats DB/Inst:labsf03 Snaps: 1-2
Tablespace
 Tablespace          Filename
                      Filename
------------------------ ----------------------------------------------------
 ------------------------ ----------------------------------------------------
                         Av
                          Av MxMx
Av
 Av
              Av
               Av    Rd
                      Rd RdRd   Av
                                 Av                   Av
                                                       Av       Buffer BufWt
                                                                 Buffer BufWt
      Reads Reads/s (ms) Bkt Blks/Rd
       Reads Reads/s (ms) Bkt Blks/Rd       Writes Writes/s
                                             Writes Writes/s     Waits (ms)
                                                                  Waits (ms)
---------- ---- ------- ----- --- ------- ------------ -------- ---------- --
 ---------- ---- ------- ----- --- ------- ------------ -------- ---------- --
SYSTEM
 SYSTEM                   /u01/app/oracle/oradata/labsf03/system01.dbf
                           /u01/app/oracle/oradata/labsf03/system01.dbf
        445
         445   15
                15 0.4 16
                     0.4 16     1.0
                                 1.0       1,157
                                            1,157      39
                                                        39     2,744
                                                                2,744 93.3
                                                                         93.3
USERS
 USERS                    /u01/app/oracle/oradata/labsf03/users01.dbf
                           /u01/app/oracle/oradata/labsf03/users01.dbf
        223
         223     77 0.5 ###
                     0.5 ###    1.0
                                 1.0       9,725
                                            9,725     324
                                                       324         44 100.0
                                                                        100.0




    IO should be under 20ms
    Fastest possible is around 7ms
    Faster speeds are due to read caching
                             Copyright 2006 Kyle Hailey
Step 1b: Ave Read Time
select
 select
    to_char(begin_interval_time,'yyyy-mm-dd hh24:mi') snap_time,
     to_char(begin_interval_time,'yyyy-mm-dd hh24:mi') snap_time,
    file#, readtim/nullif(phyrds,0) avg_read_ms, phyrds
     file#, readtim/nullif(phyrds,0) avg_read_ms, phyrds
from
 from                           SNAP_TIME              FILE# AVG_READ_MS PHYRDS
                                 SNAP_TIME              FILE# AVG_READ_MS PHYRDS
   DBA_HIST_FILESTATXS f, 2008-01-05 12:00
    DBA_HIST_FILESTATXS f, 2008-01-05 12:00                99     36.67      39
                                                                   36.67      39
   dba_hist_snapshot ss
    dba_hist_snapshot           2008-01-05 12:00
                                 2008-01-05 12:00         10
                                                           10     32.31
                                                                   32.31     39
                                                                              39
                             2008-01-05 13:00
                               2008-01-05 13:00               11    11.63
                                                                     11.63   178224
                                                                              178224
where f.snap_id=s.snap_id ; ; 2008-01-05 13:00
where f.snap_id=s.snap_id
                               2008-01-05 13:00               22    56.37
                                                                     56.37     2014
                                                                                2014
                             2008-01-05 13:00
                              2008-01-05 13:00                33    17.38
                                                                     17.38    50668
                                                                               50668
                             2008-01-05 13:00
                              2008-01-05 13:00                44     9.39
                                                                      9.39   565321
                                                                              565321
                             2008-01-05 13:00
                              2008-01-05 13:00                55    38.78
                                                                     38.78       41
                                                                                  41
                             2008-01-05 13:00
                              2008-01-05 13:00                66    28.29
                                                                     28.29       41
                                                                                  41
                             2008-01-05 13:00
                              2008-01-05 13:00                77    27.44
                                                                     27.44       39
                                                                                  39
                             2008-01-05 13:00
                              2008-01-05 13:00                88    42.56
                                                                     42.56       39
                                                                                  39
                             2008-01-05 13:00
                              2008-01-05 13:00                99    36.67
                                                                     36.67       39
                                                                                  39
                             2008-01-05 13:00
                              2008-01-05 13:00               10
                                                              10    32.31
                                                                     32.31       39
                                                                                  39
IO should be under 20ms
Fastest possible is around 7ms
Faster speeds are due to read caching
                                Copyright 2006 Kyle Hailey
Step 1c: Ave Read Time
select
 select
     to_char(begin_time,'yyyy-mm-dd hh24:mi') begin_time,
      to_char(begin_time,'yyyy-mm-dd hh24:mi') begin_time,
     file_id fid,
      file_id fid,
     average_read_time *10 avgrd_ms,
      average_read_time *10 avgrd_ms,
     average_write_time *10 avgwr_ms,
      average_write_time *10 avgwr_ms,
     physical_reads pr,
      physical_reads pr,
     physical_writes pw
      physical_writes pw          BEGIN_TIME        FID AVGRD_MS AVGWR_MS         PR         PW
from
 from
                                   BEGIN_TIME        FID AVGRD_MS AVGWR_MS         PR         PW
                                  ---------------- ---- -------- -------- ---------- ----------
                                   ---------------- ---- -------- -------- ---------- ----------
    V$FILEMETRIC_HISTORY ff 2008-01-30 12:25 11
     V$FILEMETRIC_HISTORY
                                  2008-01-30 12:25           5.2
                                                              5.2
                                                                      2.5
                                                                       2.5
                                                                                 100
                                                                                  100
                                                                                             24
                                                                                              24
                                  2008-01-30 12:25    5     80.0     20.0          2          2
order by begin_time;
 order by begin_time;
                                   2008-01-30 12:25
                                  2008-01-30 12:25    2
                                                        5    80.0
                                                            36.7
                                                                      20.0
                                                                      2.0          3
                                                                                     2
                                                                                            218
                                                                                                2
                                   2008-01-30 12:25     2    36.7      2.0           3       218
                                              2008-01-30 12:25    4    22.8    1.8    89    2754
                                               2008-01-30 12:25    4    22.8    1.8    89    2754
                                              2008-01-30 12:25    3    22.9    2.6    14      47
                                               2008-01-30 12:25    3    22.9    2.6    14      47

IO should be under 20ms
Fastest possible is around 7ms
Faster speeds are due to read caching
                                    Copyright 2006 Kyle Hailey
Step1 & OEM
 ADDM advisory expects I/Os to be under 10ms
 Can change the behavior with


 exec DBMS_ADVISOR.SET_DEFAULT_TASK_PARAMETER(
                 'ADDM',
                 'DBIO_EXPECTED',
                 <new value>);
Step 2 : Buffer Pool Advisory

Buffer Pool Advisory
 Buffer Pool Advisory Buffers for
Size for
 Size for       Size
                 Size       Buffers for                Read
                                                        Read          Estimated
                                                                       Estimated
PP    Est (M) Factor
       Est (M) Factor          Estimate
                                Estimate            Factor
                                                     Factor     Physical Reads
                                                                 Physical Reads
--- -------- ------ ------------
 --- -------- ------ ------------                   ------
                                                     ------     --------------
                                                                 --------------
DD            56
               56       .1
                         .1          6,986
                                      6,986              2.3
                                                          2.3             58,928
                                                                           58,928
DD          112
             112        .2
                         .2        13,972
                                    13,972               1.6
                                                          1.6             42,043
                                                                           42,043
DD          224
             224        .4
                         .4        27,944
                                    27,944               1.0
                                                          1.0             25,772
                                                                           25,772
DD          336
             336        .6
                         .6        41,916
                                    41,916               1.0
                                                          1.0             25,715
                                                                           25,715
DD          448
             448        .8
                         .8        55,888
                                    55,888               1.0
                                                          1.0             25,715
                                                                           25,715
DD          596
             596      1.0
                       1.0         74,351
                                    74,351               1.0
                                                          1.0             25,715
                                                                           25,715
DD          728
             728      1.2
                       1.2         90,818
                                    90,818               1.0
                                                          1.0             25,715
                                                                           25,715
DD          840
             840      1.4
                       1.4       104,790
                                  104,790                1.0
                                                          1.0             25,715
                                                                           25,715
DD          952
             952      1.6
                       1.6       118,762
                                  118,762                1.0
                                                          1.0             25,715
                                                                           25,715
DD       1,064
          1,064       1.8
                       1.8       132,734
                                  132,734                1.0
                                                          1.0             25,715
                                                                           25,715



                             Copyright 2006 Kyle Hailey
Step 3: Find Top I/O SQL
select count(*),sql_id, event
 select count(*),sql_id, event
from v$active_session_history
 from v$active_session_history
where event in ('db file sequential read',
 where event in ('db file sequential read',
                  'db file scattered read',
                   'db file scattered read',
                  'db file parallel read')
                   'db file parallel read')
group by sql_id, event
 group by sql_id, event
order by count(*);
 order by count(*);
                COUNT(*) SQL_ID
                 COUNT(*) SQL_ID                   EVENT
                                                    EVENT
                      10 8hk7xvhua40va db file sequential read
                       10 8hk7xvhua40va db file sequential read
                     335 3hatpjzrqvfn7 db file sequential read
                      335 3hatpjzrqvfn7 db file sequential read
                     343 0uuqgjq7k12nf db file sequential read
                      343 0uuqgjq7k12nf db file sequential read
                     549 75621g9y3xmvd db file sequential read
                      549 75621g9y3xmvd db file sequential read
                    1311 0bzhqhhj9mpaa db file sequential read
                     1311 0bzhqhhj9mpaa db file sequential read
                    1523 41zu158rqf4kf db file sequential read
                     1523 41zu158rqf4kf db file sequential read
                    1757 0yas01u2p9ch4 db file sequential read
                     1757 0yas01u2p9ch4 db file sequential read


                      Copyright 2006 Kyle Hailey
Step 3: OEM find top SQL




            Copyright 2006 Kyle Hailey
IO Configuration Issues
 Unix Buffer Cache
 Disk Spindles Machine Memory
 Raid 5              Unix File                     Not
                        Unix File                   Physical IO   SGA
                         Cache


                                                    Physical IO




                 If average IO read times
                 are under 7ms them
                 probably coming from Unix
                 File Cache
                       Copyright 2006 Kyle Hailey
IO Throughput
One Disk 74G – Few IOPS                 92 IO/sec




37 Disks 2G – Many IOPS                   1887 IO/sec




                     Copyright 2006 Kyle Hailey
Disk 2Gb vs 70GB
                                Seagate                  Seagate
                                Barracuda 4LP            Cheetah 73LP
 Capacity                       2.16GB                   73.4GB
 Rotation Speed                 7200rpm                  10000rpm
 Rotational Delay(avg)          4.1ms                    3ms
 Time to read 32Kb              6ms                      3ms
 Seek Time (avg)                9.4ms                    4.9
 Total time for Single I/O      19.5ms                   10.9ms
 I/O per second                 51                       92
 (conservative)
 IOPs/sec per 100GB             2550                     126
                   James Morle http://scaleability.com

                          Copyright 2006 Kyle Hailey
Raid 5
http://www.miracleas.com/BAARF/BAARF2.html
              P1             P2
                                                     Readers on different
B – Battle                                           disks run without conflict
A – Against
A – Any
                   P2
R – Raid                                             Writes require two reads
F - Five                                             plus a write – read data,
                                                     read parity then write
                                                     Reads can conflict on
                               P1
                                                     smaller stripe sizes 32K
                                                     or 64K
                        Copyright 2006 Kyle Hailey
Raid Levels
  Raid Level              none           0             0+1             5
                                          (stripe)     (striped then
                                                       mirrored)

  Control file            2              1             1               3
  Redo log                4              1             1               3
  System tablespace       2              1             1               3
  Sort segment            4              1             1               3
  Rollback segment        2              1             1               5
  Index read only         2              1             1               1
  Sequential read only    4              1             1               3
  DBWR intensive files    1              1             1               5
  Direct load intensive   4              1             1               3
  Data protection         4              5             1               2
  Operating costs         1              1             5               3

http://www.miracleas.com/BAARF/1.Millsap2000.01.03-RAID5.pdf
                          Copyright 2006 Kyle Hailey
Direct I/O WAITS
Direct I/O :
This mechanism lets the client bypass the buffer cache for
I/O intensive operations.
The disk blocks are written into and read from process
   private memory.
 direct path read :
    Parallel   Query
 direct path write
    sqlldr
    loading/reading LOBs
    parallel DMLs
    create table as select
    create index
 direct path read temp , direct path write temp
    Sorting


                        Copyright 2006 Kyle Hailey
Direct IO

        Shadow
        Process

        PGA
       Sort Area                             Buffer Cache
      Direct Path
      PQO Reads

                             X


                    Copyright 2006 Kyle Hailey
direct path read
 Buffer Cache

                 Parallel Query
                    See     v$px_session


     X                select parameter1, parameter2, parameter3
                      from v$event_name
                      where name='direct path read';
    Shadow            PARAMETER1           PARAMETER2 PARAMETER3
    Process
                      file number first dba               block cnt
    PGA
     PQO

                             _serial_direct_read = true




                   Copyright 2006 Kyle Hailey
Further Investigation ASH
select
 select
      session_id sid,
       session_id sid,
      QC_SESSION_ID qsid,
       QC_SESSION_ID qsid,
      ash.p3,
       ash.p3,
      CURRENT_OBJ#||' '||o.object_name objn,
       CURRENT_OBJ#||' '||o.object_name objn,
      o.object_type otype,
       o.object_type otype,
      CURRENT_FILE# fn,
       CURRENT_FILE# fn,
      CURRENT_BLOCK# blockn,
       CURRENT_BLOCK# blockn,
      ash.SQL_ID
       ash.SQL_ID
from v$active_session_history ash,
 from v$active_session_history ash,
     all_objects o
      all_objects o
where event like 'direct path read'
 where event like 'direct path read'
   and o.object_id (+)= ash.CURRENT_OBJ#
    and o.object_id (+)= ash.CURRENT_OBJ#
Order by sample_time;
 Order by sample_time;
       SID QSID P3 OBJN OTYPE FN BLOCKN SQL_ID
        SID QSID P3 OBJN OTYPE FN BLOCKN SQL_ID
       --- ---- -- ----- ------ -- ------ -------------
        --- ---- -- ----- ------ -- ------ -------------
       149 152 8 TOTO TABLE
        149 152 8 TOTO TABLE 1 194072 4gp8tg0b2s722
                                  1 194072 4gp8tg0b2s722
       144 152 8 TOTO TABLE
        144 152 8 TOTO TABLE     1 192304 4gp8tg0b2s722
                                  1 192304 4gp8tg0b2s722
        60 152 8 TOTO TABLE
         60 152 8 TOTO TABLE     1 190592 4gp8tg0b2s722
                                  1 190592 4gp8tg0b2s722
        54 152 6 TOTO TABLE
         54 152 6 TOTO TABLE     1 201274 4gp8tg0b2s722
                                  1 201274 4gp8tg0b2s722
       149 152 8 TOTO TABLE
        149 152 8 TOTO TABLE     1 198552 4gp8tg0b2s722
                                  1 198552 4gp8tg0b2s722

                             Copyright 2006 Kyle Hailey
PQO - ASH
select
    ash.SQL_ID,
    QC_SESSION_ID qsid,
    count(*) cnt,
    count (distinct session_id) deg,
    nvl(o.object_name,to_char(CURRENT_OBJ#)) obj,
    o.object_type otype,
    decode(session_state, 'WAITING',event,'CPU') event
from v$active_session_history ash,
     all_objects o
where o.object_id (+)= ash.CURRENT_OBJ#
  and qc_session_id is not null
            SQL_ID          QSID CNT DEG OBJ             OTYPE   EVENT
group by qc_session_id, sql_id, o.object_name,
            7p3jt75phub2d 144 386         4 WAIT_OBJECTS TABLE   PX Deq Credit: send blkd
      o.object_type, CURRENT_OBJ#, event, session_stateTABLE
                              144     4   3 WAIT_OBJECTS         PX qref latch
Order by qc_session_id, sql_id144    37   1 WAIT_OBJECTS TABLE   db file sequential read
                           144     3   2   WAIT_OBJECTS TABLE    direct path read
                           144    70   1   WAIT_OBJECTS TABLE    CPU
                           144    21   4   0                     PX Deq Credit: send blkd
                           144    12   4   0                     db file sequential read
direct path write
                           Occurs when:
                              insert /*+ APPEND */
                              sql*loader direct=y
                              Create table as select
                              Loading LOBS
                              Parallel insert
    Buffer Cache
                              Create index

   Shadow                    select parameter1, parameter2, parameter3
   Process                   from v$event_name
                             where name='direct path write';
                   DBWR
    PGA                      PARAMETER1           PARAMETER2 PARAMETER3
                             file number first dba          block cnt

                             Seems to be a bug on 10g where
                             direct path write waits are
    DATA                     incorrectly recorded as CPU


                          Copyright 2006 Kyle Hailey
Direct Path Read Temp
Direct Path Write Temp
                                     select parameter1, parameter2, parameter3
   Sorting                          from v$event_name
                                     where name in ('direct path write temp‘,
   Write to Temp                                   ‘direct path read temp’);
                                     PARAMETER1       PARAMETER2 PARAMETER3
   Read from Temp
                                     file number first dba        block cnt
                                     file number first dba        block cnt


                 Shadow
                 Process

                 PGA




          TEMP       DATA
                                            Buffer Cache

                       Copyright 2006 Kyle Hailey
Direct Path Read Temp
Direct Path Write Temp
                   This event happens when sorting overflows the memory buffers and has to be
                   written to disk. If it's a problem consider increasing parameter


                   pga_aggregate_target
                   The explain plan can give estimated sort size requirements and extended row
                   source stats in the explain plan can give the actual sort size usage of the SQL
                   statement
   Buffer Cache



        Shadow
        Process    select s.sid, s. process,
                            s.sql_id,                             SID   SQL_ID             SEGTYPE MB TABLESPACE
                            tmp.segtype,                          ---   -------------      ------- -- ----------
                          ((tmp.blocks*8)/1024) MB,                90   gm5s0vc0vzppc      SORT     2 TEMP03
        PGA        from
                            tmp.tablespace
                                                                  105   gm5s0vc0vzppc      SORT     2 TEMP03
                        v$tempseg_usage tmp,                       80   gm5s0vc0vzppc      SORT     2 TEMP03
                        v$session s                               105   gm5s0vc0vzppc      HASH     2 TEMP03
                   where tmp.session_num=s.serial#                102   gm5s0vc0vzppc      SORT     2 TEMP03
                      and segtype in ('HASH','SORT')               90   gm5s0vc0vzppc      HASH     2 TEMP03
                   order by blocks desc



 TEMP       DATA


                                 Copyright 2006 Kyle Hailey
PGA Aggregate Target
  Manual override broken 10.2.0.3 fixed in 11.1.0.7
        alter session set workarea_size_policy = manual;
        alter session set sort_area_size = 104857600;
  Workaround, run command twice
        alter session set sort_area_size = 104857600;
        alter session set sort_area_size = 104857600;
  But doesn’t work for parallel connections that still fall back
      on default which is 64K unless otherwise specified
  HASH_AREA_SIZE seems unaffected by problem

 9i, a single sessions maximum sort area using PGA_AGGREGATE_TARGET was fixed to
      100M unless setting
      _pga_max_size: Maximum PGA size for a single process
            Defaults to 200M
      _smm_max_size: Maximum workarea size for one process , defined in KILO BYTES
             Defaults Min(0.05*pga_aggregate_target,0.5*_pga_max_size,100M)


 In 10.2 max sort size is 10% of PGA_AGGREGATE_TARGET
          (100M applies as long as pga_aggregate_target is smaller than 1GB)
           example : pga_aggregate_target set to 5GB
             _smm_max_size of 500MB (was 100MB )
             _pga_max_size of 1000MB (was 200MB).
                                                    Copyright 2006 Kyle Hailey
Data file init write

  When autoextend is set and many extensions are
   happening
  Can be the root cause of other waits
     Enq:   TX - contention




                           Copyright 2006 Kyle Hailey
Local Write Wait
  Truncating a table
  Wait for Data Cache to be cleared of all blocks of
   truncated table
  Wait by shadow for DBWR

  If a problem try
        GTT
       (reduce db cache size , not usually an option)




                           Copyright 2006 Kyle Hailey
Further Investigation
select * from v$event_name
where name = ‘local write wait'
NAME
 NAME                   P1
                         P1          P2
                                      P2           P3
                                                    P3
local write wait file# block#
 local write wait file# block#

select
    ash.p1,ash.p2, ash.SQL_ID, count(*)
from v$ash ash
where event='local write wait'
group by                        P1 P2   SQL_ID     COUNT

ash.p1,ash.p2, ash.SQL_ID;     201 2 0q8k9xfmz0k2k   194
                                     201           5 0q8k9xfmz0k2k   34
                                     201           6 0q8k9xfmz0k2k    9
                                     201           4 0q8k9xfmz0k2k   10
                      Copyright 2006 Kyle Hailey
Temporary File #’s
SQL> select file# from v$datafile;
  FILE#
    1                     Wait Temporary File#’s =
    2                     Db_files + file#
    3
    4                     SQL> show parameters db_files
    5                     NAME                   VALUE
    6
    7                     db_files                200
    8
SQL> select file# from v$tempfile;
  FILE#
     2                        File# 201 = v$tempfile 1
     1
                       Copyright 2006 Kyle Hailey
Local Write Wait:extent allocation


 CREATE TEMPORARY TABLESPACE "NEWTEMP"
  TEMPFILE '/d3/temp01.dbf' SIZE 100M
  AUTOEXTEND ON
  EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K;

        ALTER DATABASE DEFAULT
        TEMPORARY TABLESPACE newtemp;


             select a.*, b.*
             from dba_objects a, dba_objects b
             order by a.owner
                     Copyright 2006 Kyle Hailey
Local Write Waits




              Copyright 2006 Kyle Hailey
Local Write Wait: Solutions
  Truncating a table
    Use  GTT
    ( reduce size of buffer cache – unlikely)

  Temporary Table Space Allocations
    Increase   extent size




                          Copyright 2006 Kyle Hailey
Summary I/O
 Buffer Cache IO
   db file sequential read
   db file scattered read
   db file parallel read

 Tune
   I/O’s
        should be < 10 ms
   Check Buffer Cache Advisory
   Tune SQL




                        Copyright 2006 Kyle Hailey
Summary Direct I/O and Other
  direct path read
       PQO
  direct path write
     direct    path operations
  direct path read temp / direct path write temp
       sorts
  direct path write (lob)
       stored NOCACHE
  local write wait –
     Temp extensions
     Truncates
  data file init write – data file extension

                            Copyright 2006 Kyle Hailey

Weitere ähnliche Inhalte

Was ist angesagt?

Quick guide of the most common linux commands
Quick guide of the most common linux commandsQuick guide of the most common linux commands
Quick guide of the most common linux commandsCarlos Enrique
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file managementAcácio Oliveira
 
第2回 Hadoop 輪読会
第2回 Hadoop 輪読会第2回 Hadoop 輪読会
第2回 Hadoop 輪読会Toshihiro Suzuki
 
Unix Commands
Unix CommandsUnix Commands
Unix CommandsDr.Ravi
 
How to create a non managed standby database
How to create a non managed  standby databaseHow to create a non managed  standby database
How to create a non managed standby databaseJorge Batista
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Ahmed El-Arabawy
 
List command linux a z
List command linux a zList command linux a z
List command linux a zJinyuan Loh
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testingGaruda Trainings
 
Perl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File ProcessingPerl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File ProcessingDanairat Thanabodithammachari
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scriptingvceder
 
Perintah dasar terminal kali linux
Perintah dasar terminal kali linuxPerintah dasar terminal kali linux
Perintah dasar terminal kali linuxFaizalguswanda
 

Was ist angesagt? (20)

Quick guide of the most common linux commands
Quick guide of the most common linux commandsQuick guide of the most common linux commands
Quick guide of the most common linux commands
 
archive A-Z linux
archive A-Z linuxarchive A-Z linux
archive A-Z linux
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file management
 
第2回 Hadoop 輪読会
第2回 Hadoop 輪読会第2回 Hadoop 輪読会
第2回 Hadoop 輪読会
 
Perl Programming - 04 Programming Database
Perl Programming - 04 Programming DatabasePerl Programming - 04 Programming Database
Perl Programming - 04 Programming Database
 
Smiley011
Smiley011Smiley011
Smiley011
 
Comenzi unix
Comenzi unixComenzi unix
Comenzi unix
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
 
Unix Commands
Unix CommandsUnix Commands
Unix Commands
 
Linux Shell Basics
Linux Shell BasicsLinux Shell Basics
Linux Shell Basics
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
How to create a non managed standby database
How to create a non managed  standby databaseHow to create a non managed  standby database
How to create a non managed standby database
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands
 
List command linux a z
List command linux a zList command linux a z
List command linux a z
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Perl Programming - 03 Programming File
Perl Programming - 03 Programming FilePerl Programming - 03 Programming File
Perl Programming - 03 Programming File
 
Perl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File ProcessingPerl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File Processing
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Perintah dasar terminal kali linux
Perintah dasar terminal kali linuxPerintah dasar terminal kali linux
Perintah dasar terminal kali linux
 
Oracle Tracing
Oracle TracingOracle Tracing
Oracle Tracing
 

Andere mochten auch

Aula0 gpes ana_mpu_50334
Aula0 gpes ana_mpu_50334Aula0 gpes ana_mpu_50334
Aula0 gpes ana_mpu_50334Raquel Oliveira
 
Para mi gatita linda
Para mi gatita lindaPara mi gatita linda
Para mi gatita lindaGOKUDBZ29
 
BAIT1003 Chapter 1
BAIT1003 Chapter 1BAIT1003 Chapter 1
BAIT1003 Chapter 1limsh
 
Literatura argentina 2 - Apuntes de clase
Literatura argentina 2 - Apuntes de claseLiteratura argentina 2 - Apuntes de clase
Literatura argentina 2 - Apuntes de claseProfeblog SB
 
Sociedad de la información y educación
Sociedad de la información y educaciónSociedad de la información y educación
Sociedad de la información y educaciónIntegridad Política
 
Estrategias competitivas básicas
Estrategias competitivas básicasEstrategias competitivas básicas
Estrategias competitivas básicasLarryJimenez
 

Andere mochten auch (8)

Aula0 gpes ana_mpu_50334
Aula0 gpes ana_mpu_50334Aula0 gpes ana_mpu_50334
Aula0 gpes ana_mpu_50334
 
Para mi gatita linda
Para mi gatita lindaPara mi gatita linda
Para mi gatita linda
 
BAIT1003 Chapter 1
BAIT1003 Chapter 1BAIT1003 Chapter 1
BAIT1003 Chapter 1
 
Literatura argentina 2 - Apuntes de clase
Literatura argentina 2 - Apuntes de claseLiteratura argentina 2 - Apuntes de clase
Literatura argentina 2 - Apuntes de clase
 
Literatura argentina (con wikipedia)
Literatura argentina (con wikipedia)Literatura argentina (con wikipedia)
Literatura argentina (con wikipedia)
 
27 fcs157al3
27 fcs157al327 fcs157al3
27 fcs157al3
 
Sociedad de la información y educación
Sociedad de la información y educaciónSociedad de la información y educación
Sociedad de la información y educación
 
Estrategias competitivas básicas
Estrategias competitivas básicasEstrategias competitivas básicas
Estrategias competitivas básicas
 

Ähnlich wie Oracle 10g Performance: chapter 07 io

Kyle Hailey Oracle Performance IO Waits
Kyle Hailey  Oracle Performance IO WaitsKyle Hailey  Oracle Performance IO Waits
Kyle Hailey Oracle Performance IO Waitscookie1969
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files pptAbhaysinh Surve
 
Introduction to file system and OCFS2
Introduction to file system and OCFS2Introduction to file system and OCFS2
Introduction to file system and OCFS2Gang He
 
Java File I/O Performance Analysis - Part I - JCConf 2018
Java File I/O Performance Analysis - Part I - JCConf 2018Java File I/O Performance Analysis - Part I - JCConf 2018
Java File I/O Performance Analysis - Part I - JCConf 2018Michael Fong
 
Internal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya JyothiInternal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya JyothiSowmya Jyothi
 
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Kyle Hailey
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedBertrand Dunogier
 
AOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyondAOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyondZubair Nabi
 
Hot and cold data storage
Hot and cold data storageHot and cold data storage
Hot and cold data storageRohit Arora
 
File system1.pptx
File system1.pptxFile system1.pptx
File system1.pptxSamar954063
 
Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)It Academy
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSvtunotesbysree
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Martijn Verburg
 

Ähnlich wie Oracle 10g Performance: chapter 07 io (20)

Kyle Hailey Oracle Performance IO Waits
Kyle Hailey  Oracle Performance IO WaitsKyle Hailey  Oracle Performance IO Waits
Kyle Hailey Oracle Performance IO Waits
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files ppt
 
Introduction to file system and OCFS2
Introduction to file system and OCFS2Introduction to file system and OCFS2
Introduction to file system and OCFS2
 
Java File I/O Performance Analysis - Part I - JCConf 2018
Java File I/O Performance Analysis - Part I - JCConf 2018Java File I/O Performance Analysis - Part I - JCConf 2018
Java File I/O Performance Analysis - Part I - JCConf 2018
 
Internal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya JyothiInternal representation of file chapter 4 Sowmya Jyothi
Internal representation of file chapter 4 Sowmya Jyothi
 
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
 
osd - co1 session7.pptx
osd - co1 session7.pptxosd - co1 session7.pptx
osd - co1 session7.pptx
 
Updates
UpdatesUpdates
Updates
 
Updates
UpdatesUpdates
Updates
 
Distcp gobblin
Distcp gobblinDistcp gobblin
Distcp gobblin
 
AFS introduction
AFS introductionAFS introduction
AFS introduction
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisited
 
AOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyondAOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyond
 
Hot and cold data storage
Hot and cold data storageHot and cold data storage
Hot and cold data storage
 
Bluestore
BluestoreBluestore
Bluestore
 
Bluestore
BluestoreBluestore
Bluestore
 
File system1.pptx
File system1.pptxFile system1.pptx
File system1.pptx
 
Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
 

Mehr von Kyle Hailey

Hooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume LelargeHooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume LelargeKyle Hailey
 
Performance insights twitch
Performance insights twitchPerformance insights twitch
Performance insights twitchKyle Hailey
 
History of database monitoring
History of database monitoringHistory of database monitoring
History of database monitoringKyle Hailey
 
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
 
Successfully convince people with data visualization
Successfully convince people with data visualizationSuccessfully convince people with data visualization
Successfully convince people with data visualizationKyle Hailey
 
Virtual Data : Eliminating the data constraint in Application Development
Virtual Data :  Eliminating the data constraint in Application DevelopmentVirtual Data :  Eliminating the data constraint in Application Development
Virtual Data : Eliminating the data constraint in Application DevelopmentKyle Hailey
 
DBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentDBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentKyle Hailey
 
Accelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual DataAccelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual DataKyle Hailey
 
Delphix and Pure Storage partner
Delphix and Pure Storage partnerDelphix and Pure Storage partner
Delphix and Pure Storage partnerKyle Hailey
 
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
Mark Farnam  : Minimizing the Concurrency Footprint of TransactionsMark Farnam  : Minimizing the Concurrency Footprint of Transactions
Mark Farnam : Minimizing the Concurrency Footprint of TransactionsKyle Hailey
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata securityKyle Hailey
 
Martin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle GuysMartin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle GuysKyle Hailey
 
Data as a Service
Data as a Service Data as a Service
Data as a Service Kyle Hailey
 
Data Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloningData Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloning Kyle Hailey
 
BGOUG "Agile Data: revolutionizing database cloning'
BGOUG  "Agile Data: revolutionizing database cloning'BGOUG  "Agile Data: revolutionizing database cloning'
BGOUG "Agile Data: revolutionizing database cloning'Kyle Hailey
 
Denver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualizationDenver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualizationKyle Hailey
 
Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix Kyle Hailey
 
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseOaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseKyle Hailey
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writerKyle Hailey
 

Mehr von Kyle Hailey (20)

Hooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume LelargeHooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume Lelarge
 
Performance insights twitch
Performance insights twitchPerformance insights twitch
Performance insights twitch
 
History of database monitoring
History of database monitoringHistory of database monitoring
History of database monitoring
 
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
 
Successfully convince people with data visualization
Successfully convince people with data visualizationSuccessfully convince people with data visualization
Successfully convince people with data visualization
 
Virtual Data : Eliminating the data constraint in Application Development
Virtual Data :  Eliminating the data constraint in Application DevelopmentVirtual Data :  Eliminating the data constraint in Application Development
Virtual Data : Eliminating the data constraint in Application Development
 
DBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentDBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application Development
 
Accelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual DataAccelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual Data
 
Delphix and Pure Storage partner
Delphix and Pure Storage partnerDelphix and Pure Storage partner
Delphix and Pure Storage partner
 
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
Mark Farnam  : Minimizing the Concurrency Footprint of TransactionsMark Farnam  : Minimizing the Concurrency Footprint of Transactions
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata security
 
Martin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle GuysMartin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle Guys
 
What is DevOps
What is DevOpsWhat is DevOps
What is DevOps
 
Data as a Service
Data as a Service Data as a Service
Data as a Service
 
Data Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloningData Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloning
 
BGOUG "Agile Data: revolutionizing database cloning'
BGOUG  "Agile Data: revolutionizing database cloning'BGOUG  "Agile Data: revolutionizing database cloning'
BGOUG "Agile Data: revolutionizing database cloning'
 
Denver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualizationDenver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualization
 
Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix
 
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseOaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
 
Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writer
 

Kürzlich hochgeladen

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Kürzlich hochgeladen (20)

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

Oracle 10g Performance: chapter 07 io

  • 1. IO Waits Kyle Hailey Kyle.hailey@embarcadero.com http://oraclemonitor.com
  • 2. Waits Covered in this Section 1. db file sequential read 2. db file scattered read Buffer Cache I/O 3. db file parallel read 4. read by other session 5. direct path read 6. direct path write 7. direct path read temp 8. direct path write temp PGA I/O 9. direct path write (lob) 10. Local write wait 11. data file init write Special Cases Copyright 2006 Kyle Hailey
  • 3. IO Waits SGA Log Library Buffer Buffer Cache Cache User1 DBWR Data Files Copyright 2006 Kyle Hailey
  • 4. Standard Table/Index IO 1. db file sequential read  Single block read 1. db file scattered read  Multi block read 1. db file parallel read  Non-contiguous multi block read 1. read by other session  Wait for another session to do the io Copyright 2006 Kyle Hailey
  • 5. db file sequential read Buffer Cache  The top wait  Single Block Read  Data via Index and/or Rowid  Rollback (if expecting FTS => problem) Select **from emp where empno = 9999; Select from emp where empno = 9999; Shadow Index on emp.empno Process 1) Search Buffer Cache for the block by rowid 2) Fails Note: “sequential” means 3) Reads of disk A sequence like a • File rowid • Block Copyright 2006 Kyle Hailey
  • 6. db file scattered read  Multi Block Read Buffer Cache  FullTable Scan  Index Fast Full Scans SQL> select * from emp; SQL> select * from emp; Shadow Process 1) Search Buffer Cache for the blocks Note: Scattered Means 2) Fails Blocks are read and 3) Reads off disk • File scattered throughout • Block buffer cache • Multi Block Read Count db_file_multiblock_read_count Copyright 2006 Kyle Hailey
  • 7. db file parallel read Buffer Cache  Process issues multiple single block reads in parallel  Documentation says only for recovery  But seems to happen for normal read ops  Async Call – wait for all reads to complete  Examples  Not contiguous multi block read  Index full or range scan Shadow  Where values in Select **from emp where Process Select from emp where Empno in (1,2,3,4,5,6); Empno in (1,2,3,4,5,6); 1) Search Buffer Cache for the blocks 2) Fails 3) Reads that block off Disk Copyright 2006 Kyle Hailey
  • 8. Read by other Session Buffer Cache Multiple sessions reading the same data that requires IO Ex) two users doing a full table scan at the same time S1 S2 1. Block not found in cache 2. Read block from disk 3. Found other session already reading block from disk 4. Wait for the other session to finish IO Copyright 2006 Kyle Hailey
  • 9. IO – Further Investigation select parameter1, parameter2, parameter3 from v$event_name NAME P1 P2 P3 read by other session file# block# class# db file sequential read file# block# blocks db file scattered read file# block# blocks db file parallel read files blocks requests P1 and P2 are file# , block# We can use P1, P2, P3 from ASH to get more info Exception: db file parallel read – p1,p2,p3 not useful Copyright 2006 Kyle Hailey
  • 10. sequential reads – blocks read select event, ash.p3, o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like 'db file sequential read' and o.object_id (+)= ash.CURRENT_OBJ# order by sample_time; P3= # of blocks EVENT P3 OBJN OTYPE FILEN BLOCKN SQL_ID db file sequential read 1 49890 MGMT_METRICS_1HOUR_ INDEX 3 41737 db file sequential read 1 50908 MGMT_DB_SGA_ECM TABLE 3 28489 35at43xqj7bs0 db file sequential read 1 55303 TOTO TABLE 1 60218 7xftj55rvjw9s Copyright 2006 Kyle Hailey
  • 11. scattered reads – multi blocks read select event, ash.p3, o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like 'db file scattered read' and o.object_id (+)= ash.CURRENT_OBJ# P3= # of order by sample_time; blocks EVENT P3 OBJN OTYPE FILEN BLOCKN SQL_ID db file scattered read 8 9078 WRH$_SYSMETRIC_HISTO TABLE 3 52363 db file scattered read 5 8781 WRI$_ALERT_HISTORY TABLE 3 2676 db file scattered read 8 57 OBJAUTH$ TABLE 1 33993 3t2mk1prj24hu Copyright 2006 Kyle Hailey
  • 12. IO by File select io.cnt, round(io.cnt/(&v_minutes*60),2) aas, io.event, io.p1 p1, f.tablespace_name from ( select count(*) cnt, substr(event,0,25) event, ash.p1 p1 from v$active_session_history ash where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &v_minutes/(60*24) group by event , ash.p1 ) io, dba_data_files f CNT AAS EVENT P1 TABLESPACE where 1 .00 db file sequential read 1 SYSTEM f.file_id = io.p1 2 .00 db file sequential read 3 SYSAUX Order by io.cnt ; 38 .06 db file sequential read 6 SOE 179 .30 db file sequential read 7 SOEINDEX
  • 13. IO by Object select count(*) cnt, CURRENT_OBJ#||' '||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like 'db file s%' or event like 'direct%' ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &1/(60*24) and session_state='WAITING' group by CURRENT_OBJ#, o.object_name , o.object_type Order by count(*) CNT AAS OBJN OTYPE PARTITION.00 79 52949 ORDER_ITEMS TABLE 97 .00 -1 130 .00 53117 ORD_STATUS_IX INDEX 498 .01 53120 CUST_EMAIL_IX INDEX 512 .01 0 1632 .03 53112 ITEM_ORDER_IX INDEX
  • 14. IO by SQL select round(sum(cnt) over ( partition by io.sql_id order by sql_id ) / (&v_minutes*60),2) aas, io.sql_id, io.cnt cnt, 100*cnt/sum(cnt) over ( partition by io.sql_id order by sql_id ) pct, o.object_name obj, o.subobject_name sub_obj, o.object_type otype, substr(io.event,8,10) event, AAS SQL_ID % OBJ TABLESPACE io.p1 file#, ----- ------------- --- --------------- ---------- f.tablespace_name tablespace_name, tbs.contents .18 0yas01u2p9ch4 6 ITEM_PRODUCT_IX SOEINDEX from ( 6 ORDER_ITEMS_UK SOEINDEX select 88 ITEM_ORDER_IX SOEINDEX sql_id, event, .32 6v6gm0fd1rgrz 6 WAIT_OBJECTS SYSTEM count(*) cnt, 94 UNDO UNDOTBS1 count(*) / (&v_minutes*60) aas, CURRENT_OBJ# , ash.p1 from v$active_session_history ash where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &v_minutes/(60*24) group by CURRENT_OBJ#, event, ash.p1, sql_id ) io, dba_data_files f ,all_objects o , dba_tablespaces tbs where f.file_id = io.p1 and o.object_id (+)= io.CURRENT_OBJ# and tbs.tablespace_name= f.tablespace_name Order by tcnt, sql_id, cnt /
  • 15. Missing Object IDs  dba_extents – get object name select segment_name, select segment_name, segment_type segment_type from dba_extents from dba_extents where file_id = P1 where file_id = P1 and P2 between and P2 between block_id and block_id + blocks – 1; block_id and block_id + blocks – 1;  Dba_extents is notoriously slow  Options  Create a table as select – use table  recreate as object extents change  Catch blocks in x$bh when waits occur Copyright 2006 Kyle Hailey
  • 16. Copy of dba_extents Enter value for file: 3 Enter value for block: 6619 OWNER SEGMENT_NAME SEGMENT_TYPE WMSYS LOG_TAB_PK INDEX Elapsed: 00:00:41.25 create table myextents as select * from dba_extents Table created. Elapsed: 00:01:25.73 CNT OWN SEGMENT_NAME SEGMENT_TYPE 11 SYS SMON_SCN_TO_TIME CLUSTER 993 SYS _SYSSMU7$ TYPE2 UNDO 150 rows selected. Elapsed: 00:00:01.03
  • 17. IO Solutions 1. Check average read times per file  Should be between 5-20 ms  Data in Statspack under “File IO Stats” 1. Check Cache buffer Hit ratio  Check db_cache_advice 9i and higher  Data in Statspack under “Buffer Pool Advisory”  Want to optimize data caching 1. Tune High IO SQL  Check reads off of UNDO Copyright 2006 Kyle Hailey
  • 18. Step 1a: Ave Read Time File IO Stats DB/Inst:labsf03 Snaps: 1-2 File IO Stats DB/Inst:labsf03 Snaps: 1-2 Tablespace Tablespace Filename Filename ------------------------ ---------------------------------------------------- ------------------------ ---------------------------------------------------- Av Av MxMx Av Av Av Av Rd Rd RdRd Av Av Av Av Buffer BufWt Buffer BufWt Reads Reads/s (ms) Bkt Blks/Rd Reads Reads/s (ms) Bkt Blks/Rd Writes Writes/s Writes Writes/s Waits (ms) Waits (ms) ---------- ---- ------- ----- --- ------- ------------ -------- ---------- -- ---------- ---- ------- ----- --- ------- ------------ -------- ---------- -- SYSTEM SYSTEM /u01/app/oracle/oradata/labsf03/system01.dbf /u01/app/oracle/oradata/labsf03/system01.dbf 445 445 15 15 0.4 16 0.4 16 1.0 1.0 1,157 1,157 39 39 2,744 2,744 93.3 93.3 USERS USERS /u01/app/oracle/oradata/labsf03/users01.dbf /u01/app/oracle/oradata/labsf03/users01.dbf 223 223 77 0.5 ### 0.5 ### 1.0 1.0 9,725 9,725 324 324 44 100.0 100.0 IO should be under 20ms Fastest possible is around 7ms Faster speeds are due to read caching Copyright 2006 Kyle Hailey
  • 19. Step 1b: Ave Read Time select select to_char(begin_interval_time,'yyyy-mm-dd hh24:mi') snap_time, to_char(begin_interval_time,'yyyy-mm-dd hh24:mi') snap_time, file#, readtim/nullif(phyrds,0) avg_read_ms, phyrds file#, readtim/nullif(phyrds,0) avg_read_ms, phyrds from from SNAP_TIME FILE# AVG_READ_MS PHYRDS SNAP_TIME FILE# AVG_READ_MS PHYRDS DBA_HIST_FILESTATXS f, 2008-01-05 12:00 DBA_HIST_FILESTATXS f, 2008-01-05 12:00 99 36.67 39 36.67 39 dba_hist_snapshot ss dba_hist_snapshot 2008-01-05 12:00 2008-01-05 12:00 10 10 32.31 32.31 39 39 2008-01-05 13:00 2008-01-05 13:00 11 11.63 11.63 178224 178224 where f.snap_id=s.snap_id ; ; 2008-01-05 13:00 where f.snap_id=s.snap_id 2008-01-05 13:00 22 56.37 56.37 2014 2014 2008-01-05 13:00 2008-01-05 13:00 33 17.38 17.38 50668 50668 2008-01-05 13:00 2008-01-05 13:00 44 9.39 9.39 565321 565321 2008-01-05 13:00 2008-01-05 13:00 55 38.78 38.78 41 41 2008-01-05 13:00 2008-01-05 13:00 66 28.29 28.29 41 41 2008-01-05 13:00 2008-01-05 13:00 77 27.44 27.44 39 39 2008-01-05 13:00 2008-01-05 13:00 88 42.56 42.56 39 39 2008-01-05 13:00 2008-01-05 13:00 99 36.67 36.67 39 39 2008-01-05 13:00 2008-01-05 13:00 10 10 32.31 32.31 39 39 IO should be under 20ms Fastest possible is around 7ms Faster speeds are due to read caching Copyright 2006 Kyle Hailey
  • 20. Step 1c: Ave Read Time select select to_char(begin_time,'yyyy-mm-dd hh24:mi') begin_time, to_char(begin_time,'yyyy-mm-dd hh24:mi') begin_time, file_id fid, file_id fid, average_read_time *10 avgrd_ms, average_read_time *10 avgrd_ms, average_write_time *10 avgwr_ms, average_write_time *10 avgwr_ms, physical_reads pr, physical_reads pr, physical_writes pw physical_writes pw BEGIN_TIME FID AVGRD_MS AVGWR_MS PR PW from from BEGIN_TIME FID AVGRD_MS AVGWR_MS PR PW ---------------- ---- -------- -------- ---------- ---------- ---------------- ---- -------- -------- ---------- ---------- V$FILEMETRIC_HISTORY ff 2008-01-30 12:25 11 V$FILEMETRIC_HISTORY 2008-01-30 12:25 5.2 5.2 2.5 2.5 100 100 24 24 2008-01-30 12:25 5 80.0 20.0 2 2 order by begin_time; order by begin_time; 2008-01-30 12:25 2008-01-30 12:25 2 5 80.0 36.7 20.0 2.0 3 2 218 2 2008-01-30 12:25 2 36.7 2.0 3 218 2008-01-30 12:25 4 22.8 1.8 89 2754 2008-01-30 12:25 4 22.8 1.8 89 2754 2008-01-30 12:25 3 22.9 2.6 14 47 2008-01-30 12:25 3 22.9 2.6 14 47 IO should be under 20ms Fastest possible is around 7ms Faster speeds are due to read caching Copyright 2006 Kyle Hailey
  • 21. Step1 & OEM  ADDM advisory expects I/Os to be under 10ms  Can change the behavior with exec DBMS_ADVISOR.SET_DEFAULT_TASK_PARAMETER( 'ADDM', 'DBIO_EXPECTED', <new value>);
  • 22. Step 2 : Buffer Pool Advisory Buffer Pool Advisory Buffer Pool Advisory Buffers for Size for Size for Size Size Buffers for Read Read Estimated Estimated PP Est (M) Factor Est (M) Factor Estimate Estimate Factor Factor Physical Reads Physical Reads --- -------- ------ ------------ --- -------- ------ ------------ ------ ------ -------------- -------------- DD 56 56 .1 .1 6,986 6,986 2.3 2.3 58,928 58,928 DD 112 112 .2 .2 13,972 13,972 1.6 1.6 42,043 42,043 DD 224 224 .4 .4 27,944 27,944 1.0 1.0 25,772 25,772 DD 336 336 .6 .6 41,916 41,916 1.0 1.0 25,715 25,715 DD 448 448 .8 .8 55,888 55,888 1.0 1.0 25,715 25,715 DD 596 596 1.0 1.0 74,351 74,351 1.0 1.0 25,715 25,715 DD 728 728 1.2 1.2 90,818 90,818 1.0 1.0 25,715 25,715 DD 840 840 1.4 1.4 104,790 104,790 1.0 1.0 25,715 25,715 DD 952 952 1.6 1.6 118,762 118,762 1.0 1.0 25,715 25,715 DD 1,064 1,064 1.8 1.8 132,734 132,734 1.0 1.0 25,715 25,715 Copyright 2006 Kyle Hailey
  • 23. Step 3: Find Top I/O SQL select count(*),sql_id, event select count(*),sql_id, event from v$active_session_history from v$active_session_history where event in ('db file sequential read', where event in ('db file sequential read', 'db file scattered read', 'db file scattered read', 'db file parallel read') 'db file parallel read') group by sql_id, event group by sql_id, event order by count(*); order by count(*); COUNT(*) SQL_ID COUNT(*) SQL_ID EVENT EVENT 10 8hk7xvhua40va db file sequential read 10 8hk7xvhua40va db file sequential read 335 3hatpjzrqvfn7 db file sequential read 335 3hatpjzrqvfn7 db file sequential read 343 0uuqgjq7k12nf db file sequential read 343 0uuqgjq7k12nf db file sequential read 549 75621g9y3xmvd db file sequential read 549 75621g9y3xmvd db file sequential read 1311 0bzhqhhj9mpaa db file sequential read 1311 0bzhqhhj9mpaa db file sequential read 1523 41zu158rqf4kf db file sequential read 1523 41zu158rqf4kf db file sequential read 1757 0yas01u2p9ch4 db file sequential read 1757 0yas01u2p9ch4 db file sequential read Copyright 2006 Kyle Hailey
  • 24. Step 3: OEM find top SQL Copyright 2006 Kyle Hailey
  • 25. IO Configuration Issues  Unix Buffer Cache  Disk Spindles Machine Memory  Raid 5 Unix File Not Unix File Physical IO SGA Cache Physical IO If average IO read times are under 7ms them probably coming from Unix File Cache Copyright 2006 Kyle Hailey
  • 26. IO Throughput One Disk 74G – Few IOPS 92 IO/sec 37 Disks 2G – Many IOPS 1887 IO/sec Copyright 2006 Kyle Hailey
  • 27. Disk 2Gb vs 70GB Seagate Seagate Barracuda 4LP Cheetah 73LP Capacity 2.16GB 73.4GB Rotation Speed 7200rpm 10000rpm Rotational Delay(avg) 4.1ms 3ms Time to read 32Kb 6ms 3ms Seek Time (avg) 9.4ms 4.9 Total time for Single I/O 19.5ms 10.9ms I/O per second 51 92 (conservative) IOPs/sec per 100GB 2550 126 James Morle http://scaleability.com Copyright 2006 Kyle Hailey
  • 28. Raid 5 http://www.miracleas.com/BAARF/BAARF2.html P1 P2 Readers on different B – Battle disks run without conflict A – Against A – Any P2 R – Raid Writes require two reads F - Five plus a write – read data, read parity then write Reads can conflict on P1 smaller stripe sizes 32K or 64K Copyright 2006 Kyle Hailey
  • 29. Raid Levels Raid Level none 0 0+1 5 (stripe) (striped then mirrored) Control file 2 1 1 3 Redo log 4 1 1 3 System tablespace 2 1 1 3 Sort segment 4 1 1 3 Rollback segment 2 1 1 5 Index read only 2 1 1 1 Sequential read only 4 1 1 3 DBWR intensive files 1 1 1 5 Direct load intensive 4 1 1 3 Data protection 4 5 1 2 Operating costs 1 1 5 3 http://www.miracleas.com/BAARF/1.Millsap2000.01.03-RAID5.pdf Copyright 2006 Kyle Hailey
  • 30. Direct I/O WAITS Direct I/O : This mechanism lets the client bypass the buffer cache for I/O intensive operations. The disk blocks are written into and read from process private memory.  direct path read :  Parallel Query  direct path write  sqlldr  loading/reading LOBs  parallel DMLs  create table as select  create index  direct path read temp , direct path write temp  Sorting Copyright 2006 Kyle Hailey
  • 31. Direct IO Shadow Process PGA Sort Area Buffer Cache Direct Path PQO Reads X Copyright 2006 Kyle Hailey
  • 32. direct path read Buffer Cache  Parallel Query  See v$px_session X select parameter1, parameter2, parameter3 from v$event_name where name='direct path read'; Shadow PARAMETER1 PARAMETER2 PARAMETER3 Process file number first dba block cnt PGA PQO _serial_direct_read = true Copyright 2006 Kyle Hailey
  • 33. Further Investigation ASH select select session_id sid, session_id sid, QC_SESSION_ID qsid, QC_SESSION_ID qsid, ash.p3, ash.p3, CURRENT_OBJ#||' '||o.object_name objn, CURRENT_OBJ#||' '||o.object_name objn, o.object_type otype, o.object_type otype, CURRENT_FILE# fn, CURRENT_FILE# fn, CURRENT_BLOCK# blockn, CURRENT_BLOCK# blockn, ash.SQL_ID ash.SQL_ID from v$active_session_history ash, from v$active_session_history ash, all_objects o all_objects o where event like 'direct path read' where event like 'direct path read' and o.object_id (+)= ash.CURRENT_OBJ# and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time; Order by sample_time; SID QSID P3 OBJN OTYPE FN BLOCKN SQL_ID SID QSID P3 OBJN OTYPE FN BLOCKN SQL_ID --- ---- -- ----- ------ -- ------ ------------- --- ---- -- ----- ------ -- ------ ------------- 149 152 8 TOTO TABLE 149 152 8 TOTO TABLE 1 194072 4gp8tg0b2s722 1 194072 4gp8tg0b2s722 144 152 8 TOTO TABLE 144 152 8 TOTO TABLE 1 192304 4gp8tg0b2s722 1 192304 4gp8tg0b2s722 60 152 8 TOTO TABLE 60 152 8 TOTO TABLE 1 190592 4gp8tg0b2s722 1 190592 4gp8tg0b2s722 54 152 6 TOTO TABLE 54 152 6 TOTO TABLE 1 201274 4gp8tg0b2s722 1 201274 4gp8tg0b2s722 149 152 8 TOTO TABLE 149 152 8 TOTO TABLE 1 198552 4gp8tg0b2s722 1 198552 4gp8tg0b2s722 Copyright 2006 Kyle Hailey
  • 34. PQO - ASH select ash.SQL_ID, QC_SESSION_ID qsid, count(*) cnt, count (distinct session_id) deg, nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, o.object_type otype, decode(session_state, 'WAITING',event,'CPU') event from v$active_session_history ash, all_objects o where o.object_id (+)= ash.CURRENT_OBJ# and qc_session_id is not null SQL_ID QSID CNT DEG OBJ OTYPE EVENT group by qc_session_id, sql_id, o.object_name, 7p3jt75phub2d 144 386 4 WAIT_OBJECTS TABLE PX Deq Credit: send blkd o.object_type, CURRENT_OBJ#, event, session_stateTABLE 144 4 3 WAIT_OBJECTS PX qref latch Order by qc_session_id, sql_id144 37 1 WAIT_OBJECTS TABLE db file sequential read 144 3 2 WAIT_OBJECTS TABLE direct path read 144 70 1 WAIT_OBJECTS TABLE CPU 144 21 4 0 PX Deq Credit: send blkd 144 12 4 0 db file sequential read
  • 35. direct path write  Occurs when:  insert /*+ APPEND */  sql*loader direct=y  Create table as select  Loading LOBS  Parallel insert Buffer Cache  Create index Shadow select parameter1, parameter2, parameter3 Process from v$event_name where name='direct path write'; DBWR PGA PARAMETER1 PARAMETER2 PARAMETER3 file number first dba block cnt Seems to be a bug on 10g where direct path write waits are DATA incorrectly recorded as CPU Copyright 2006 Kyle Hailey
  • 36. Direct Path Read Temp Direct Path Write Temp select parameter1, parameter2, parameter3  Sorting from v$event_name where name in ('direct path write temp‘,  Write to Temp ‘direct path read temp’); PARAMETER1 PARAMETER2 PARAMETER3  Read from Temp file number first dba block cnt file number first dba block cnt Shadow Process PGA TEMP DATA Buffer Cache Copyright 2006 Kyle Hailey
  • 37. Direct Path Read Temp Direct Path Write Temp This event happens when sorting overflows the memory buffers and has to be written to disk. If it's a problem consider increasing parameter pga_aggregate_target The explain plan can give estimated sort size requirements and extended row source stats in the explain plan can give the actual sort size usage of the SQL statement Buffer Cache Shadow Process select s.sid, s. process, s.sql_id, SID SQL_ID SEGTYPE MB TABLESPACE tmp.segtype, --- ------------- ------- -- ---------- ((tmp.blocks*8)/1024) MB, 90 gm5s0vc0vzppc SORT 2 TEMP03 PGA from tmp.tablespace 105 gm5s0vc0vzppc SORT 2 TEMP03 v$tempseg_usage tmp, 80 gm5s0vc0vzppc SORT 2 TEMP03 v$session s 105 gm5s0vc0vzppc HASH 2 TEMP03 where tmp.session_num=s.serial# 102 gm5s0vc0vzppc SORT 2 TEMP03 and segtype in ('HASH','SORT') 90 gm5s0vc0vzppc HASH 2 TEMP03 order by blocks desc TEMP DATA Copyright 2006 Kyle Hailey
  • 38. PGA Aggregate Target Manual override broken 10.2.0.3 fixed in 11.1.0.7 alter session set workarea_size_policy = manual; alter session set sort_area_size = 104857600; Workaround, run command twice alter session set sort_area_size = 104857600; alter session set sort_area_size = 104857600; But doesn’t work for parallel connections that still fall back on default which is 64K unless otherwise specified HASH_AREA_SIZE seems unaffected by problem 9i, a single sessions maximum sort area using PGA_AGGREGATE_TARGET was fixed to 100M unless setting _pga_max_size: Maximum PGA size for a single process Defaults to 200M _smm_max_size: Maximum workarea size for one process , defined in KILO BYTES Defaults Min(0.05*pga_aggregate_target,0.5*_pga_max_size,100M) In 10.2 max sort size is 10% of PGA_AGGREGATE_TARGET (100M applies as long as pga_aggregate_target is smaller than 1GB) example : pga_aggregate_target set to 5GB _smm_max_size of 500MB (was 100MB ) _pga_max_size of 1000MB (was 200MB). Copyright 2006 Kyle Hailey
  • 39. Data file init write  When autoextend is set and many extensions are happening  Can be the root cause of other waits  Enq: TX - contention Copyright 2006 Kyle Hailey
  • 40. Local Write Wait  Truncating a table  Wait for Data Cache to be cleared of all blocks of truncated table  Wait by shadow for DBWR  If a problem try  GTT  (reduce db cache size , not usually an option) Copyright 2006 Kyle Hailey
  • 41. Further Investigation select * from v$event_name where name = ‘local write wait' NAME NAME P1 P1 P2 P2 P3 P3 local write wait file# block# local write wait file# block# select ash.p1,ash.p2, ash.SQL_ID, count(*) from v$ash ash where event='local write wait' group by P1 P2 SQL_ID COUNT ash.p1,ash.p2, ash.SQL_ID; 201 2 0q8k9xfmz0k2k 194 201 5 0q8k9xfmz0k2k 34 201 6 0q8k9xfmz0k2k 9 201 4 0q8k9xfmz0k2k 10 Copyright 2006 Kyle Hailey
  • 42. Temporary File #’s SQL> select file# from v$datafile; FILE# 1 Wait Temporary File#’s = 2 Db_files + file# 3 4 SQL> show parameters db_files 5 NAME VALUE 6 7 db_files 200 8 SQL> select file# from v$tempfile; FILE# 2 File# 201 = v$tempfile 1 1 Copyright 2006 Kyle Hailey
  • 43. Local Write Wait:extent allocation CREATE TEMPORARY TABLESPACE "NEWTEMP" TEMPFILE '/d3/temp01.dbf' SIZE 100M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K; ALTER DATABASE DEFAULT TEMPORARY TABLESPACE newtemp; select a.*, b.* from dba_objects a, dba_objects b order by a.owner Copyright 2006 Kyle Hailey
  • 44. Local Write Waits Copyright 2006 Kyle Hailey
  • 45. Local Write Wait: Solutions  Truncating a table  Use GTT  ( reduce size of buffer cache – unlikely)  Temporary Table Space Allocations  Increase extent size Copyright 2006 Kyle Hailey
  • 46. Summary I/O  Buffer Cache IO  db file sequential read  db file scattered read  db file parallel read  Tune  I/O’s should be < 10 ms  Check Buffer Cache Advisory  Tune SQL Copyright 2006 Kyle Hailey
  • 47. Summary Direct I/O and Other  direct path read  PQO  direct path write  direct path operations  direct path read temp / direct path write temp  sorts  direct path write (lob)  stored NOCACHE  local write wait –  Temp extensions  Truncates  data file init write – data file extension Copyright 2006 Kyle Hailey

Hinweis der Redaktion

  1. col block_type for a18 col objn for a25 col otype for a15 col event for a25 select event, ash.p3, CURRENT_OBJ#||&apos; &apos;||o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like &apos;db file s%&apos; and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time /
  2. col block_type for a18 col objn for a25 col otype for a15 col event for a25 select event, ash.p3, CURRENT_OBJ#||&apos; &apos;||o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like &apos;db file s%&apos; and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time /
  3. col block_type for a18 col objn for a25 col otype for a15 col event for a25 col blockn for 999999 col p1 for 9999 col aas for 999.99 col f_minutes new_value v_minutes select &amp;minutes f_minutes from dual; select io.cnt, round(io.cnt/(&amp;v_minutes*60),2) aas, io.event, io.p1 p1, f.tablespace_name from ( select count(*) cnt, substr(event,0,25) event, ash.p1 p1 from v$active_session_history ash where ( event like &apos;db file s%&apos; or event like &apos;direct%&apos; ) and sample_time &gt; sysdate - &amp;v_minutes/(60*24) group by event , ash.p1 ) io, dba_data_files f where f.file_id = io.p1 Order by io.cnt /
  4. col block_type for a18 col obj for a20 col objn for 999999 col otype for a15 col event for a15 col blockn for 999999 col p1 for 9999 col tablespace_name for a15 col f_minutes new_value v_minutes select &amp;minutes f_minutes from dual; break on sql_id on tcnt select sum(cnt) over ( partition by io.sql_id order by sql_id ) tcnt, io.sql_id, io.cnt cnt, io.aas aas, --io.event event, io.objn objn, io.obj obj, io.p1 p1, f.tablespace_name tablespace_name from ( select sql_id, count(*) cnt, round(count(*)/(&amp;v_minutes*60),2) aas, CURRENT_OBJ# objn, nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj, o.object_type otype, ash.p1 from v$active_session_history ash ,all_objects o where ( event like &apos;db file s%&apos; or event like &apos;direct%&apos; ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time &gt; sysdate - &amp;v_minutes/(60*24) group by CURRENT_OBJ#, o.object_name , o.object_type , ash.p1, sql_id ) io, dba_data_files f where f.file_id = io.p1 Order by tcnt, io.sql_id, io.cnt /
  5. col avgrd_ms format 9,999.9 col avgwr_ms format 9,999.9 col fid for 999 col pr for 9,999 col pw for 9,999 select to_char(begin_time,&apos;yyyy-mm-dd hh24:mi&apos;) begin_time, file_id fid, average_read_time *10 avgrd_ms, average_write_time *10 avgwr_ms, physical_reads pr, physical_writes pw from V$FILEMETRIC_HISTORY f order by begin_time /
  6. There is a parameter - DBIO_EXPECTED - that tells ADDM what is an acceptable average single block read in micro seconds. The parameter defaults to 10000 micro seconds and can be changed with:   exec DBMS_ADVISOR.SET_DEFAULT_TASK_PARAMETER(&apos;ADDM&apos;,&apos;DBIO_EXPECTED&apos;, &lt;new value&gt;); If your CT (as expected) hasn&apos;t changed from default then the 20 mS per single block read is the reason for the ADDM finding.
  7. select --+ parallel(a,4) count(*) from toto a; o col block_type for a18 col objn for a25 col otype for a15 col event for a25 col p3 for 999 col fn for 999 col sid for 9999 col qsid for 9999 select session_id sid, QC_SESSION_ID qsid, --event, --ash.p1, --ash.p2, ash.p3, CURRENT_OBJ#||&apos; &apos;||o.object_name objn, o.object_type otype, CURRENT_FILE# fn, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like &apos;direct path read&apos; and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time /
  8. col qsid for 9999 col cnt for 9999 col deg for 999 col obj for a15 col otype for a10 select ash.SQL_ID, QC_SESSION_ID qsid, count(*) cnt, count (distinct session_id) deg, --ash.p3, nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, o.object_type otype, --CURRENT_FILE# fn, --CURRENT_BLOCK# blockn, decode(session_state, &apos;WAITING&apos;,event,&apos;CPU&apos;) event from v$active_session_history ash, all_objects o where -- event like &apos;direct path read&apos; o.object_id (+)= ash.CURRENT_OBJ# and qc_session_id is not null group by qc_session_id, sql_id, o.object_name, o.object_type, CURRENT_OBJ#, event, session_state Order by qc_session_id, sql_id / ================================ From Greg Rahn select s.sql_id,       px.INST_ID &quot;Inst&quot;,       px.SERVER_GROUP &quot;Group&quot;,       px.SERVER_SET &quot;Set&quot;,       px.DEGREE &quot;Degree&quot;,       px.REQ_DEGREE &quot;Req Degree&quot;,       w.event &quot;Wait Event&quot; from GV$SESSION s, GV$PX_SESSION px, GV$PROCESS p, GV$SESSION_WAIT w where s.sid (+) = px.sid and      s.inst_id (+) = px.inst_id and      s.sid = w.sid (+) and      s.inst_id = w.inst_id (+) and      s.paddr = p.addr (+) and      s.inst_id = p.inst_id (+) ORDER BY decode(px.QCINST_ID,  NULL, px.INST_ID,  px.QCINST_ID),         px.QCSID,         decode(px.SERVER_GROUP, NULL, 0, px.SERVER_GROUP),         px.SERVER_SET,         px.INST_ID;