Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB   


 

 

 


 

 

 
 


dba_hist_seg_stat tips

Oracle Tips by Burleson Consulting

June 12, 2010

Segment Statistics dba_hist_seg_stat

The AWR repository also stores a history for a set of segment related statistics such as logical reads, physical reads and writes, buffer busy waits, row lock waits, etc. Also note this related segment growth script.  The kernel AWR view for segment statistics is dba_hist_seg_stat.

 

SQL> desc DBA_HIST_SEG_STAT

 

Name                                      Null?    Type

----------------------------------------- -------- ----------

SNAP_ID                                            NUMBER

DBID                                               NUMBER

INSTANCE_NUMBER                                    NUMBER

TS#                                                NUMBER

OBJ#                                               NUMBER

DATAOBJ#                                           NUMBER

LOGICAL_READS_TOTAL                                NUMBER

LOGICAL_READS_DELTA                                NUMBER

BUFFER_BUSY_WAITS_TOTAL                            NUMBER

BUFFER_BUSY_WAITS_DELTA                            NUMBER

DB_BLOCK_CHANGES_TOTAL                             NUMBER

DB_BLOCK_CHANGES_DELTA                             NUMBER

PHYSICAL_READS_TOTAL                               NUMBER

PHYSICAL_READS_DELTA                               NUMBER

PHYSICAL_WRITES_TOTAL                              NUMBER

PHYSICAL_WRITES_DELTA                              NUMBER

PHYSICAL_READS_DIRECT_TOTAL                        NUMBER

PHYSICAL_READS_DIRECT_DELTA                        NUMBER

PHYSICAL_WRITES_DIRECT_TOTAL                       NUMBER

PHYSICAL_WRITES_DIRECT_DELTA                       NUMBER

ITL_WAITS_TOTAL                                    NUMBER

ITL_WAITS_DELTA                                    NUMBER

ROW_LOCK_WAITS_TOTAL                               NUMBER

ROW_LOCK_WAITS_DELTA                               NUMBER

GC_CR_BLOCKS_SERVED_TOTAL                          NUMBER

GC_CR_BLOCKS_SERVED_DELTA                          NUMBER

GC_CU_BLOCKS_SERVED_TOTAL                          NUMBER

GC_CU_BLOCKS_SERVED_DELTA                          NUMBER

SPACE_USED_TOTAL                                   NUMBER

SPACE_USED_DELTA                                   NUMBER

SPACE_ALLOCATED_TOTAL                              NUMBER

SPACE_ALLOCATED_DELTA                              NUMBER

TABLE_SCANS_TOTAL                                  NUMBER

TABLE_SCANS_DELTA                                  NUMBER

 

 

This view contains historical snapshots for the v$segstat dynamic performance view. Oracle10g also has a more user friendly dynamic view called v$segment_statistics which shows the same statistics along with additional owner and segment names, tablespace name, etc. Available segment-level statistics can be selected from the v$segstat_name view:

 

SQL> select name from V$SEGSTAT_NAME;

 

NAME                                

-------------------------------------

logical reads                       

buffer busy waits                    

gc buffer busy                      

db block changes                    

physical reads                      

physical writes                     

physical reads direct               

physical writes direct              

gc cr blocks received               

gc current blocks received          

ITL waits                           

row lock waits                      

space used                          

space allocated                     

segment scans

 

Reviewing the segment-level statistics history helps us to identify hot segments in the database such as tables and indexes, which possibly play a significant role in performance problems. For example, if the database has a high value of TX enqueue waits, the dba_hist_seg_stat view can be queried to find actual segments experiencing high row lock activity.

 

Users can query the dba_hist_seg_stat  view using various criteria to identify hot segments. For example, the seg_top_logreads_10g.sql script retrieves top segments that have high logical reads activity:

 

<      seg_top_logreads_10g.sql

 

 

select

    object_name "Object Name"

  , tablespace_name "Tablespace Name"

  , object_type "Object Type"

  , logical_reads_total "Logical Reads"

  , ratio "%Total"

from(

select n.owner||'.'||n.object_name||decode(n.subobject_name,null,null,'.'||n.subobject_name) object_name

     , n.tablespace_name

     , case when length(n.subobject_name) < 11 then

              n.subobject_name

            else

              substr(n.subobject_name,length(n.subobject_name)-9)

       end subobject_name

     , n.object_type

     , r.logical_reads_total

     , round(r.ratio * 100, 2) ratio

  from dba_hist_seg_stat_obj  n

     , (select *

          from (select e.dataobj#

                     , e.obj#

                     , e.dbid

                     , e.logical_reads_total - nvl(b.logical_reads_total, 0) logical_reads_total

                     , ratio_to_report(e.logical_reads_total - nvl(b.logical_reads_total, 0)) over () ratio

                  from dba_hist_seg_stat  e

                     , dba_hist_seg_stat  b

                 where b.snap_id  = 2694

                   and e.snap_id  = 2707

                   and b.dbid     = 37933856   

                   and e.dbid     = 37933856

                   and b.instance_number  = 1

                   and e.instance_number  = 1

                   and e.obj#             = b.obj#

                   and e.dataobj#         = b.dataobj#

               and e.logical_reads_total - nvl(b.logical_reads_total, 0)  > 0

                 order by logical_reads_total desc) d

          where rownum <= 100) r

 where n.dataobj# = r.dataobj#

SEE CODE DEPOT FOR FULL SCRIPTS

)

order by logical_reads_total desc;

 

This script allows the identification of hot segments which experience high logical reads activity. This information may help with the selection of tuning actions such as the optimization of corresponding queries that access these segments, re-distribute segments across different disks, etc.

 

SQL> @seg_top_logreads.sql

 

Object Name                    Tablespace Object Type Logical Reads %Total

------------------------------ ---------- ----------- ------------- ------

SYSMAN.MGMT_METRICS_RAW_PK     SYSAUX     INDEX              46,272   8.68

SYS.SMON_SCN_TIME              SYSTEM     TABLE              43,840   8.23

SYS.JOB$                       SYSTEM     TABLE              30,640   5.75

SYS.I_SYSAUTH1                 SYSTEM     INDEX              27,120   5.09

PERFSTAT.STATS$EVENT_HISTOGRAM SYSAUX     INDEX              26,912   5.05

 

The Ion tool also has several reports for the retrieval of hot segments using the following criteria:

§       Top logical reads.

§       Top physical reads.

§       Top physical writes.

§       Top buffer busy waits.

§       Top row lock waits.

§       Top block changes.

The dba_hist_seg_stat view has two columns for each statistic: total and delta. The total column shows the cumulative value of the statistic and the delta column shows change in the statistic value between begin_interval_time   and end_interval_time in the dba_hist_snapshot view for the corresponding snap_id in the dba_hist_seg_stat view.

 
 
  Guarantee your Success!

Oracle is the world's most complex, robust and flexible database, considered impossible to master without a mentor.

That's why all BC Oracle trainers are working professionals, experts in Oracle who share their tips and secrets.



 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2011 by Burleson Enterprises

All rights reserved.

Oracle © is the registered trademark of Oracle Corporation.


 

  
 

 
 
 
 
Oracle performance tuning software
 
 

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books