SlideShare a Scribd company logo
1 of 84
10g New Performance Features
   1.   Alerts
   2.   Metrics
   3.   AWR ( 7 days of history DBA_HIST_ )
   4.   Time Model
   5.   Wait Classes
   6. Misc




                  Copyright 2006 Kyle Hailey   #.1
Alerts Set
 select
      metrics_name alert,                       In 10g, alerts are
      warning_operator op,                      managed in the
      warning_value warn ,
                                                database
      object_name obj
 from
     dba_thresholds;

 ALERT                                                    OP     WARN
 -----------------------------------                      ----   ------ OBJ
                                                                        -------
 Average Users Waiting Counts                             GT     10
 Concurrency
 Blocked User Session Count                               GT     0
 CPU Time Per User Call                                   GE     8000   db3
 Logons Per Sec                                           GE     100
 Session Limit %                                          GT     90
 Tablespace Space Usage                                   GE     85
 Tablespace Space Usage                                   GE     90     SYSTEM
                             Copyright 2006 Kyle Hailey                       #.2
Alerts Outstanding

select
         reason,
         object_type type,
         object_name name
from
          dba_outstanding_alerts;


   REASON                                                  TYPE         NAME
   ------------------------------------------ ----------- -------
   Tablespace [PERFSTAT] is [97 percent] full              TABLESPACE PERFSTA




                              Copyright 2006 Kyle Hailey                        #.3
Alerts Setting
DBMS_SERVER_ALERT.SET_THRESHOLD(
 METRICS_ID              => DBMS_SERVER_ALERT.CPU_TIME_PER_CALL,
  WARNING_OPERATOR        => DBMS_SERVER_ALERT.OPERATOR_GE,
dbms_server_alert.set_threshold(
 WARNING_VALUE
 METRICS_ID              => '8000',
                         => dbms_server_alert.tablespace_pct_full,
 CRITICAL_OPERATOR
 WARNING_OPERATOR        => DBMS_SERVER_ALERT.OPERATOR_GE,
                         => dbms_server_alert.operator_ge,
 CRITICAL_VALUE
 WARNING_VALUE           => '10000',
                         => 90,
 OBSERVATION_PERIOD
 CRITICAL_OPERATOR       => 1,
                         => dbms_server_alert.operator_ge,
 CONSECUTIVE_OCCURRENCES => 2,
 CRITICAL_VALUE          => 99,
 INSTANCE_NAME
 OBSERVATION_PERIOD      => 'SID',
                         => 1,
 OBJECT_TYPE
 CONSECUTIVE_OCCURRENCES => DBMS_SERVER_ALERT.OBJECT_TYPE_SERVICE,
                         => 1,
 OBJECT_NAME
 INSTANCE_NAME           => 'SID')
                         => null,
  OBJECT_TYPE             =>   dbms_server_alert.object_type_tablespace,
  OBJECT_NAME             =>   'SYSTEM');

  http://www.psoug.org/reference/dbms_serv_alert.html
                           Copyright 2006 Kyle Hailey                #.4
9i
10g Metrics
    DBA_HIST_SQLSTAT


     v$sql
         v$sql
         SQL
                                     Waits
                                                  v$system_event
                                     v$system_event
                                                                V$eventmetric
                                                      V$waitclassmetric


                                               V$session_wait

                Metrics                       V$session_event

                 V$sesstat

 v$sysstat
    v$systat
     Stats                 v$session
                               v$session
                                Sessions                          V$sessmetric




                  V$sysmetric



                       Copyright 2006 Kyle Hailey                               #.5
Metrics
 What inspired Metrics?
   Alerting



 But … metrics make our lives easier
   Old statistics were cumulative
   Old statistics lacked history



Question:
    What is the IO on the system right now?
                   Copyright 2006 Kyle Hailey   #.6
First Tedious Step

  Select value from v$sysstat
  where name=‘physical reads’;

          VALUE

                  1,533,787


   Not much help …Why? Let see …



                   Copyright 2006 Kyle Hailey   #.7
This tells you … Nothing
        GOOD                                        BAD

                             1,533,787

                30 minutes


IO’s



                                                             30 minutes



         time                                         time


                       Copyright 2006 Kyle Hailey                  #.8
Need to do MATH to find Out


  Take value at time A
  Take value at time B
  Delta = (B-A)
    or
  Rate = (B-A)/elapsed time


               Copyright 2006 Kyle Hailey   #.9
Methods
 Oracle 6 Utlbstat.sql/Utlestat.sql
    Creates   tables, inserts, deletes
 Oracle 8 introduced Statspack
    Improvement,but needs to be set up and administered
    (by guess who)
 Oracle 10 introduces Metrics (and AWR & OEM)



   Overkill to run statspack for one or two statistics,
   now 10g gives us metric tables


                         Copyright 2006 Kyle Hailey       #.10
Performance Metric Deltas
 Kinds of Metric Tables

1. Metric – current
2. Metric History – last hour

  Current Deltas              History of Values over last hour
V$EVENTMETRIC                  V$FILEMETRIC_HISTORY
V$FILEMETRIC                   V$SYSMETRIC_HISTORY
V$SESSMETRIC                   V$SERVICEMETRIC_HISTORY
V$SERVICEMETRIC                V$WAITCLASSMETRIC_HISTORY
V$SYSMETRIC
V$SYSMETRIC_SUMMARY
V$WAITCLASSMETRIC

                                                             #.11
                    Copyright 2006 Kyle Hailey
Metrics
  Intervals                               Calculations
    15 second                                   Deltas
    60 second                                   Rates
    10 minutes - file IO                               per second
    30 minutes - sql
                                                        per transaction
                                                 Ratios
                                                 Percentages




                        Copyright 2006 Kyle Hailey                         #.12
Metric Tables
 Wait Events
      V$EVENTMETRIC (60 secs )
      V$WAITCLASSMETRIC (60 secs)

 Statistics
      V$SESSMETRIC (15 secs Deltas)
      V$SYSMETRIC (15 and 60 secs deltas)

 Files
      V$FILEMETRIC ( 10 minutes)

 SQL
      DBA_HIST_SQLSTAT




                          Copyright 2006 Kyle Hailey   #.13
Answer at your fingertips
          GOOD                                            BAD

       3 IO/sec
                                      X
                                1,533,787              513 IO/sec

                   30 minutes


IO’s



                                                                    30 minutes



            time                                             time


                          Copyright 2006 Kyle Hailey                    #.14
Now What’s the IO?

 Select VALUE , METRIC_UNIT
 from v$sysmetric
 where metric_name='Physical Reads Per Sec‘;

  VALUE METRIC_UNIT                              INTSIZE_CSEC
   654.6736 Reads Per Second                            5959
   134.9835 Reads Per Second                            1515

 Avg IO per sec for the last 15 and 60 secs

                    Copyright 2006 Kyle Hailey              #.15
v$sysmetric
desc v$sysmetric
 BEGIN_TIME
 END_TIME
 INTSIZE_CSEC – interval value in 1/100sec
 GROUP_ID
 METRIC_ID
 METRIC_NAME
 VALUE
 METRIC_UNIT


Attention: metric_names are different from v$sysstat

                      Copyright 2006 Kyle Hailey   #.16
v$sysmetric 15 Secs
                                                    Per Sec and Per Transaction
                                                    Physical Reads
Buffer Cache Hit Ratio                              Physical Writes
Memory Sorts Ratio                                  Physical Reads Direct
Execute Without Parse Ratio                         Redo Generated
                                                    Logons
Soft Parse Ratio
                                                    User Calls
Database CPU Time Ratio                             Logical Reads
Library Cache Hit Ratio                             Redo Writes
Shared Pool Free %                                  Total Table Scans
                                                    Full Index Scans
Txns Per Logon
                                                    DB Block Gets
                                                    Consistent Read Gets
  Per Sec                                           DB Block Changes
                                                    Consistent Read Changes
 User Transaction Per Sec
                                                    Executions



                              Copyright 2006 Kyle Hailey                          #.17
v$sysmetric 60 Sec
Buffer Cache Hit Ratio                          Current Logons Count
Memory Sorts Ratio                              Current Open Cursors Count
Redo Allocation Hit Ratio                       User Limit %
User Commits Percentage                         SQL Service Response Time
User Rollbacks Percentage                       Database Wait Time Ratio
Cursor Cache Hit Ratio                          Database CPU Time Ratio
Rows Per Sort                                   Row Cache Hit Ratio
Execute Without Parse Ratio                     Row Cache Miss Ratio
Soft Parse Ratio                                Library Cache Hit Ratio
User Calls Ratio                                Library Cache Miss Ratio
Global Cache Average CR Get Time                Shared Pool Free %
Global Cache Average Current Get Time           PGA Cache Hit %
Global Cache Blocks Corrupted                   Process Limit %
Global Cache Blocks Lost                        Session Limit %
                                                Txns Per Logon




                              Copyright 2006 Kyle Hailey                     #.18
v$sysmetric 60 Sec
                                      Per Second and Transaction
Per Sec                   Physical Reads                         Disk Sort
                          Physical Writes                        Enqueue Timeouts
 User Commits             Physical Reads Direct                  Enqueue Waits
 User Rollbacks           Physical Writes Direct                 Enqueue Deadlocks
 User Transaction         Physical Reads Direct Lobs             Enqueue Requests
                          Physical Writes Direct Lobs            DB Block Gets
 DBWR Checkpoints
                          Redo Generated                         Consistent Read Gets
 Background Checkpoints
                          Logons                                 DB Block Changes
 Network Traffic Volume   Open Cursors                           Consistent Read Changes
                          User Calls                             CPU Usage
Per Transaction           Recursive Calls                        CR Blocks Created
                          Logical Reads                          CR Undo Records Applied
Response Time             Redo Writes                            User Rollback Undo Records
                          Long Table Scans                     Applied
                          Total Table Scans                      Leaf Node Splits
                          Full Index Scans                       Branch Node Splits
                          Total Index Scans                      PX downgraded 1 to 25%
                          Total Parse Count                      PX downgraded 25 to 50%
                          Hard Parse Count                       PX downgraded 50 to 75%
                          Parse Failure Count                    PX downgraded 75 to 99%
                                                               .
                                  Copyright 2006 Kyle Hailey                                  #.19
v$sessmetric

desc v$sessmetric
  BEGIN_TIME
                                        • Only 15 second
  END_TIME                                Delta
  INTSIZE_CSEC
  SESSION_ID
  SESSION_SERIAL_NUM
  CPU
  PHYSICAL_READS
  PGA_MEMORY
  HARD_PARSES
  SOFT_PARSES
  PHYSICAL_READ_PCT
  LOGICAL_READ_PCT



                      Copyright 2006 Kyle Hailey           #.20
Desc v$eventmetric

 SQL> desc v$eventmetric
  Name                                         Type
  ----------------------------------         ------
  BEGIN_TIME                                   DATE
  END_TIME                                     DATE
  INTSIZE_CSEC                               NUMBER
  EVENT#                                     NUMBER
  EVENT_ID                                   NUMBER
  NUM_SESS_WAITING                           NUMBER
  TIME_WAITED                                NUMBER
  WAIT_COUNT                                 NUMBER


                Copyright 2006 Kyle Hailey        #.21
Historical Metrics
 We solved what’s happening now… but

  What if your problem happened 10 minutes ago?
  How do we get History?
  What happened in the past?




                  Copyright 2006 Kyle Hailey   #.22
Metric History Tables
 Last 60 minutes of history, in memory

              v$sysstat
          physical reads                                                      delta
                                                                              delta
                                                                              delta

                                                                              delta


                                                                              delta


                                                                              delta

                                                                              delta



    60 secs   60 secs   60 secs   60 secs     60 secs     60 secs   60 secs


                                  Copyright 2006 Kyle Hailey                          #.23
Metric History Tables

Last hour of statistics at your fingertips :
Statistics                                               3 minutes of 15 second
      V$SYSMETRIC_HISTORY                                        deltas
          60 seconds for an hour
          3 minutes of 15 second

 File IO                                          60 minutes of 1 minute deltas
      V$FILEMETRIC_HISTORY
          10 minutes for an hour

 Waits
      V$WAITCLASSMETRIC_HISTORY
          60 seconds for an hour


                             Copyright 2006 Kyle Hailey                            #.24
What was IO 30 minutes ago?
Select
           to_char(end_time,'DD-MON-YY HH24:MI'),
           VALUE ,
           METRIC_UNIT
    from
           v$sysmetric_history
 where
           METRIC_NAME = 'Physical Reads Per Sec' and
           END_TIME < ( sysdate - (30/(24*60))) and
           END_TIME > ( sysdate - (35/(24*60)))
order by end_time;
                                       TO_CHAR(END_TIM          VALUE METRIC_UNIT
                                       08-JAN-08      11:38     118.65 Reads Per Second
                                       08-JAN-08      11:39 76.6166667 Reads Per Second
                                       08-JAN-08      11:40 3.44770153 Reads Per Second
                                       08-JAN-08      11:41       28.7 Reads Per Second
                                       08-JAN-08      11:42 19.6166667 Reads Per Second


                                 Copyright 2006 Kyle Hailey                         #.25
V$FILEMETRIC_HISTORY
select
                BEGIN_TIME,
                FILE_ID,
                PHYSICAL_READS
         from
                V$FILEMETRIC_HISTORY;

 BEGIN_TI        FILE_ID PHYSICAL_READS
 04:12:16              1                            208
 04:12:16              2                            600
                                                          Physical Reads
 04:02:18              1                            600
 04:02:18              2                            189   Broken down by
 03:52:15              1                         1922     file
 03:52:15              2                         2082
 …

                           Copyright 2006 Kyle Hailey                 #.26
Metric Alerts
 If Alerts fire on Metrics, then the deltas are kept in
    historical table for 7 days by default


 Statistics                                          Not to be confused
     DBA_HIST_SYSMETRIC_HISTORY                      with the other metric
     DBA_HIST_SESSMETRIC_HISTORY
                                                      tables, these only
 Waits                                               have values when
       WAITCLASSMETRIC_HISTORY
                                                      alerts fire

 File IO
       DBA_HIST_FILEMETRIC_HISTORY




                         Copyright 2006 Kyle Hailey                     #.27
Metrics Family of Tables
         Stats                            Waits                              Files
Raw      V$sysstat                        v$system_event                     v$fileio
                                          v$event_histogram
                                          v$system_wait_class

Now      V$sysmetric                      v$eventmetric                      v$filemetric
         V$SYSMETRIC                      v$waitclassmetric
         V$SYSMETRIC_SUMMARY
         V$SESSMETRIC
         Session : v$sessmetric

         V$sysmetric_history               v$waitclassmetric_history         v$filemetric_history
         V$sysmetric_summary
1 Hour



                                          DBA_HIST_WAITCLASSMETRIC_HISTORY   DBA_HIST_FILEMETRIC_HISTORY
         DBA_HIST_SYSMETRIC_HISTORY
7 days   DBA_HIST_SESSMETRIC_HISTORY                                         DBA_HIST_SQLSTAT
Alerts   DBA_HIST_                        DBA_HIST_SYSTEM_EVENT
only     SYSMETRIC_SUMMARY




                                       Copyright 2006 Kyle Hailey                                   #.28
AWR
Automatic Workload Repository
 Statspack on Steroids
 More efficient than Statspack
   More  in memory
   Less latching

 Keeps stats every hour
 Stores by default the last 7 days




                      Copyright 2006 Kyle Hailey   #.29
Snapshoting
Done automatically out of the box, but can be run by hand:

 BEGIN
   DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
   END;
 /




      dbms_workload_repository.drop_snapshot_range



                           Copyright 2006 Kyle Hailey        #.30
DBA_HIST
DBA_HIST_DATABASE_INSTANCE                                                     DBA_HIST_RESOURCE_LIMIT
DBA_HIST_SNAPSHOT                                                              DBA_HIST_SHARED_POOL_ADVICE
- DBA_HIST_SNAP_ERROR                                                          ?DBA_HIST_SQL_WORKAREA_HSTGRM
- DBA_HIST_BASELINE                                                            DBA_HIST_PGA_TARGET_ADVICE
- DBA_HIST_WR_CONTROL ? (work load repository ?)                               DBA_HIST_INSTANCE_RECOVERY
- DBA_HIST_DATAFILE                                                            DBA_HIST_JAVA_POOL_ADVICE
DBA_HIST_FILESTATXS – only file number, no name                                DBA_HIST_THREAD - logswitches
- DBA_HIST_TEMPFILE                                                            -DBA_HIST_STAT_NAME
DBA_HIST_TEMPSTATXS – onl;y file number                                        DBA_HIST_SYSSTAT
+DBA_HIST_SQLSTAT group by parent cursor plus DELTAs was (stats$sql_summary)   -DBA_HIST_SYS_TIME_MODEL
DBA_HIST_SQLTEXT                                                               -DBA_HIST_OSSTAT_NAME
+DBA_HIST_SQL_SUMMARY – identify litterals (was stat$sql_statistics)           -DBA_HIST_OSSTAT
DBA_HIST_SQL_PLAN                                                              DBA_HIST_PARAMETER_NAME
-DBA_HIST_SQLBIND                                                              DBA_HIST_PARAMETER
-DBA_HIST_SQLBIND_META - WRH$_SQL_BIND_METADATA
 DBA_HIST_SQLBIND_META                                                         DBA_HIST_UNDOSTAT
-DBA_HIST_OPTIMIZER_ENV                                                        DBA_HIST_ROLLSTAT
-DBA_HIST_EVENT_NAME                                                           DBA_HIST_SEG_STAT
DBA_HIST_SYSTEM_EVENT                                                          DBA_HIST_SEG_STAT_OBJ – object name
DBA_HIST_BG_EVENT_SUMMARY – sum of backgrounds                                 -DBA_HIST_METRIC_NAME
DBA_HIST_WAITSTAT                                                              -DBA_HIST_SYSMETRIC_HISTORY alert
DBA_HIST_ENQUEUE_STAT                                                          -DBA_HIST_SYSMETRIC_SUMMARY – max, min, avg standard
-DBA_HIST_LATCH_NAME                                                           deviation
DBA_HIST_LATCH                                                                 -DBA_HIST_SESSMETRIC_HISTORY alert
DBA_HIST_LATCH_CHILDREN                                                        -DBA_HIST_FILEMETRIC_HISTORY alert
DBA_HIST_LATCH_PARENT                                                          -DBA_HIST_WAITCLASSMET_HISTORY alert
DBA_HIST_LATCH_MISSES_SUMMARY – summed over parent latch                       DBA_HIST_DLM_MISC
DBA_HIST_LIBRARYCACHE                                                          -DBA_HIST_RCVRY_FILE_DEST_STAT
DBA_HIST_DB_CACHE_ADVICE                                                       -DBA_HIST_RMAN_PERFORMANCE
DBA_HIST_BUFFER_POOL_STAT                                                      -DBA_HIST_ACTIVE_SESS_HISTORY – every 10th point from
DBA_HIST_ROWCACHE_SUMMARY – summed over rowcache entries                       v$active_session_history
DBA_HIST_SGA                                                                   -DBA_HIST_TABLESPACE_STAT
DBA_HIST_SGASTAT                                                               -DBA_HIST_LOG
DBA_HIST_PGASTAT                    New in 10g                                 DBA_HIST_MTTR_TARGET_ADVICE
                                                                               -DBA_HIST_TBSPC_SPACE_USAGE - ?


                                                        Copyright 2006 Kyle Hailey                                                 #.31
Retention and Interval
 Defaults:
  Hourly snapshots
  7 days saved

 SELECT retention, snap_interval FROM wrm$_wr_control;

               RETENTION                         SNAP_INTERVAL
             +00007 00:00:00.0 +00000 01:00:00.0
                                                           Minutes
 exec dbms_workload_repository.modify_snapshot_settings(14*24*60,30);

              RETENTION                         SNAP_INTERVAL
             +00014 00:00:00.0 +00000 00:30:00.0
                          Copyright 2006 Kyle Hailey                 #.32
AWR RPT
         @?/rdbms/admin/awrrpt.sql

 Creates Report File
 Similar to STATSPACK report
 More efficient and more data
 HTML or TEXT
    SELECT * FROM TABLE(
    dbms_workload_repository.awr_report_text(
         (select dbid from v$database),
         1,
         124, -- begin id
         125 -- end id ))
                    Copyright 2006 Kyle Hailey   #.33
AWR Report


1) General info
 1) General info         11) Advisories                12) Buffer Pool Stats
                                                        12) Buffer Pool Stats
                          11) Advisories
2) Load Profile
 2) Load Profile             1) Buffer pool            13) Wait Stats
                                                        13) Wait Stats
                              1) Buffer pool
3) Wait Events
 3) Wait Events              2) PGA                        1) Buffer Busy
                                                            1) Buffer Busy
                              2) PGA
4) OS Stats
 4) OS Stats                 3) Shared Pool                2) Enqueues
                                                            2) Enqueues
                              3) Shared Pool
5) Service Stats
 5) Service Stats            4) SGA                    12) Undo Stats
                                                        12) Undo Stats
                              4) SGA
6) Top SQL
 6) Top SQL                  5) Streams                13) Latch Stats
                                                        13) Latch Stats
                              5) Streams
7) SQL Text
 7) SQL Text                 6) Java                   14) Segment Stats
                                                        14) Segment Stats
                              6) Java
8) Instance Statistic
 8) Instance Statistic                                 15) Dictionary Stats
                                                        15) Dictionary Stats
9) I/O Stat
 9) I/O Stat                                           16) Library Cache
                                                        16) Library Cache
10) Buffer Pool Stats
 10) Buffer Pool Stats                                 17) Memory SGA/PGA
                                                        17) Memory SGA/PGA
                                                       18) Streams
                                                        18) Streams
                                                       19) Init.ora
                                                        19) Init.ora
                          Copyright 2006 Kyle Hailey                     #.34
Awr 1-13




      Copyright 2006 Kyle Hailey   #.35
AWR 14-26




            Copyright 2006 Kyle Hailey   #.36
AWR Diff
SELECT * FROM TABLE(
   dbms_workload_repository.awr_diff_report_text(
     (select dbid from v$database),
      1,
      120,
      121,
     (select dbid from v$database),
      1,
      122,
      123)
);
Also : AWR_DIFF_REPORT_HTML


                   Copyright 2006 Kyle Hailey       #.37
AWR Diff Report in OEM




                                      NOTE: Package
                                      AWR_DIFF_REPORT_HTML
                                      Is different from OEM
                                      Its just a tabular output




             Copyright 2006 Kyle Hailey                           #.38
Also, ADDM report by Hand

   select dbms_advisor.get_task_report(task_name)
   from dba_advisor_tasks
   where task_id = (
                     select max(t.task_id)
                     from dba_advisor_tasks t,
                            dba_advisor_log l
                     where t.task_id = l.task_id and
                            t.advisor_name = 'ADDM' and
                            l.status = 'COMPLETED');


   Set long 100000


                       Copyright 2006 Kyle Hailey         #.39
Important AWR Tables

 DBA_HIST_SQLSTAT
     SQL deltas
 DBA_HIST_SEG_STAT
     Segment deltas
 DBA_HIST_SYSMETRIC_SUMMARY
     Stats, max, min, avg
     Trending
 DBA_HIST_ACTIVE_SESS_HISTORY
     ASH
 DBA_HIST_SYSTEM_EVENT
     Waits
                   dba_hist_sqltext – get sql text from AWR

                             Copyright 2006 Kyle Hailey       #.40
DBA_HIST_SNAPSHOT

SQL> desc DBA_HIST_SNAPSHOT
Name                Type
------------------- -----------------------
SNAP_ID             NUMBER
DBID                NUMBER
INSTANCE_NUMBER     NUMBER
STARTUP_TIME        TIMESTAMP(3)
BEGIN_INTERVAL_TIME TIMESTAMP(3)
END_INTERVAL_TIME   TIMESTAMP(3)
FLUSH_ELAPSED       INTERVAL DAY(5) TO SECOND(1)
SNAP_LEVEL          NUMBER
ERROR_COUNT         NUMBER


                   Copyright 2006 Kyle Hailey      #.41
DBA_HIST_SQLSTAT
SNAP_ID                             FETCHES_DELTA
DBID                                END_OF_FETCH_COUNT_DELTA
INSTANCE_NUMBER                     SORTS_DELTA
SQL_ID                              EXECUTIONS_DELTA
                                    PX_SERVERS_EXECS_DELTA
PLAN_HASH_VALUE
                                    LOADS_DELTA
OPTIMIZER_COST
                                    INVALIDATIONS_DELTA
OPTIMIZER_MODE                      PARSE_CALLS_DELTA
OPTIMIZER_ENV_HASH_VALUE            DISK_READS_DELTA
SHARABLE_MEM                        BUFFER_GETS_DELTA
LOADED_VERSIONS                     ROWS_PROCESSED_DELTA
VERSION_COUNT                       CPU_TIME_DELTA
MODULE                              ELAPSED_TIME_DELTA
ACTION                              IOWAIT_DELTA
SQL_PROFILE                         CLWAIT_DELTA
                                    APWAIT_DELTA
FORCE_MATCHING_SIGNATURE
                                    CCWAIT_DELTA
PARSING_SCHEMA_ID
                                    DIRECT_WRITES_DELTA
PARSING_SCHEMA_NAME                 PLSEXEC_TIME_DELTA
BIND_DATA                           JAVEXEC_TIME_DELTA

                      Copyright 2006 Kyle Hailey               #.42
DBA_HIST_SEG_STAT
                                              Gets reset every DB bounce
SQL> desc DBA_HIST_SEG_STAT              PHYSICAL_WRITES_TOTAL
                                         PHYSICAL_WRITES_DELTA
Name
                                         PHYSICAL_READS_DIRECT_TOTAL
SNAP_ID                                  PHYSICAL_READS_DIRECT_DELTA
DBID                                     PHYSICAL_WRITES_DIRECT_TOTAL
INSTANCE_NUMBER                          PHYSICAL_WRITES_DIRECT_DELTA
TS#                                      ITL_WAITS_TOTAL
OBJ#                                     ITL_WAITS_DELTA
DATAOBJ#                                 ROW_LOCK_WAITS_TOTAL
LOGICAL_READS_TOTAL                      ROW_LOCK_WAITS_DELTA
LOGICAL_READS_DELTA                      SPACE_USED_TOTAL
BUFFER_BUSY_WAITS_TOTAL                  SPACE_USED_DELTA
BUFFER_BUSY_WAITS_DELTA                  SPACE_ALLOCATED_TOTAL
DB_BLOCK_CHANGES_TOTAL                   SPACE_ALLOCATED_DELTA
DB_BLOCK_CHANGES_DELTA                   TABLE_SCANS_TOTAL
PHYSICAL_READS_TOTAL                     TABLE_SCANS_DELTA
PHYSICAL_READS_DELTA
                              Copyright 2006 Kyle Hailey                #.43
DBA_HIST_SYSTEM_EVENT

     SQL> desc DBA_HIST_SYSTEM_EVENT
      Name                 Type
      ----------------------------------
      SNAP_ID              NUMBER
      DBID                 NUMBER
      INSTANCE_NUMBER      NUMBER
      EVENT_ID             NUMBER
      EVENT_NAME           VARCHAR2(64)
      WAIT_CLASS_ID        NUMBER
      WAIT_CLASS           VARCHAR2(64)
      TOTAL_WAITS          NUMBER
      TOTAL_TIMEOUTS       NUMBER
      TIME_WAITED_MICRO    NUMBER

  Cumulative Values – can use LAG function
                   Copyright 2006 Kyle Hailey   #.44
Average Wait Times
select
    btime,
    (time_ms_end-time_ms_beg)/nullif(count_end-count_beg,0) avg_ms
from (
select
    to_char(s.BEGIN_INTERVAL_TIME,'DD-MON-YY HH24:MI') btime,
    total_waits count_end,
    time_waited_micro/1000 time_ms_end,
    Lag (e.time_waited_micro/1000)
         (
         OVER( PARTITION BY e.event_name ORDER BY s.snap_id) time_ms_beg,
    Lag (e.total_waits)
         (
         OVER( PARTITION BY e.event_name ORDER BY s.snap_id) count_beg
from
    DBA_HIST_SYSTEM_EVENT e,
    DBA_HIST_SNAPSHOT s
where                                                    BTIME                      AVG_MS
      s.snap_id=e.snap_id                                -------------------- ------------
  and e.event_name= '&1'                                 08-JAN-08 01:00             1.017
order by begin_interval_time                             08-JAN-08 02:00              .720
)
                                                         08-JAN-08 03:00              .621
order by btime;
                                                   08-JAN-08     04:00             1.747
                                                   08-JAN-08     05:00             1.046
                                                   08-JAN-08     06:00             1.444
                                    Copyright 2006 Kyle Hailey                               #.45
ASH RPT

 @?/rdbms/admin/ashrpt
 Detailed report on top SQL, Sessions, Objects etc
 Run over SQL*Net with
  select output
  from table(dbms_workload_repository.ash_report_text(
                   (select dbid from v$database),
                  1,
                  sysdate – 2/24,
                  sysdate – 1/24,
                  0)) ;

 Also ASH_REPORT_HTML


                        Copyright 2006 Kyle Hailey       #.46
ASH RPT

1) General info
 1) General info                      9) Top SQL using literals
                                       9) Top SQL using literals
2) Top User Events ***
 2) Top User Events ***               10) Top Sessions ***
                                       10) Top Sessions ***
3) Top Background Events
 3) Top Background Events             11) Top Blocking Sessions
                                       11) Top Blocking Sessions
4) Top Event P1/P2/P3 Values
 4) Top Event P1/P2/P3 Values         12) Top Sessions running PQs
                                       12) Top Sessions running PQs
5) Top Service/Module
 5) Top Service/Module                13) Top DB Objects
                                       13) Top DB Objects
6) Top Client IDs
 6) Top Client IDs                    14) Top DB Files
                                       14) Top DB Files
7) Top SQL Command Types
 7) Top SQL Command Types             15) Top Latches
                                       15) Top Latches
8) Top SQL Statements ***
 8) Top SQL Statements ***            16) Activity Over Time ***
                                       16) Activity Over Time ***




                         Copyright 2006 Kyle Hailey                   #.47
ASH RPT HTML




          Copyright 2006 Kyle Hailey   #.48
Time Model
New concept
• DB Time

                                                  Time Model
Total time for all database calls
• cpu time                   SQL
                                                 Wait
• wait time
                                      Metrics

                       Stats
                                                  Sessions

                    Copyright 2006 Kyle Hailey                 #.49
Time Model areas
 Total Time
 CPU
   Updated    every 5 seconds
 Elapsed Time
 SQL execution
 Plsql execution (sql execute subtracted out)
 Java execution
 Connection time
   Probablythe most important as it points out problems with
    too many logons/sec



                        Copyright 2006 Kyle Hailey        #.50
Time Model Components
   1) background elapsed time
       2) background cpu time

   1) DB time
      2) DB CPU
      2) connection management call elapsed time
      2) sequence load elapsed time
      2) sql execute elapsed time
      2) parse time elapsed
          3) hard parse elapsed time
              4) hard parse (sharing criteria) elapsed time
                  5) hard parse (bind mismatch) elapsed time
          3) failed parse elapsed time
              4) failed parse (out of shared memory) elapsed time
      2) PL/SQL execution elapsed time
      2) inbound PL/SQL rpc elapsed time
      2) PL/SQL compilation elapsed time
      2) Java execution elapsed time


                         Copyright 2006 Kyle Hailey                 #.51
Total Time

                  DB CPU
       DB Wait     Time
                    DB CPU
      ~ DB Total Database
            Wait
         Time
        Time Time Time
                   Parse
                  Elapsed
                   Time




          Copyright 2006 Kyle Hailey   #.52
Hard Parse Bind Mismatch




                                                  hard
                                                 parse
                                                 (bind
                                                mismat
                                       hard        ch)
                                      parse     elapsed
                               hard (sharing      time
                              parse criteria)
              Parse           elapse elapsed
               time           d time   time
             elapsed

             Copyright 2006 Kyle Hailey                   #.53
Time Model Tables
Current cumulative values
 V$SYS_TIME_MODEL
 V$SESS_TIME_MODEL


AWR Snapshots of cumulative values
 DBA_HIST_SYS_TIME_MODEL


Tables show cumulative values. To find deltas, then need
to run AWR report (no time model metric tables  )




                    Copyright 2006 Kyle Hailey         #.54
Wait Classes
 Administrative (39)                     Configuration (20)
      switch logfile                                   log file size
      rebuild index                                    Enqueues: ST, HW, ITL
                                                        Latch: redo copy,shared pool
 Application (11)                        Idle (56)
      enqueues
       sqlnet break/reset
                                          Network (25)
   


 Cluster (113)
 Commit (1)                              System I/O (19)
      Log file Sync                      Scheduler (6)
 Concurrency (12)                        User I/O (12)
      Latches: cbc, lbc,
   
   
       Lib cache locks
       Buffer busy wait                   Other (485)

                            Copyright 2006 Kyle Hailey                                  #.55
Wait Class Tables

 v$system_wait_class
   cumulative


 v$waitclassmetric
   Current   rates
 v$waitclassmetric_history
   Hour   of rates (60 second intervals)




                      Copyright 2006 Kyle Hailey   #.56
Waits Metrics
           Cumulative          Current deltas                      Last Hour                 Last 7 days
      Wait
      v$system_wait_class
     Classes                   v$waitclassmetric           v$waitclassmetric_history   dba_hist_
           WAIT_CLASS_ID
                               BEGIN_TIME                   BEGIN_TIME                 waitclassmetric_history
           WAIT_CLASS#                                      END_TIME
                               END_TIME
           WAIT_CLASS
                               INTSIZE_CSEC                 INTSIZE_CSEC               Only gets populated with alerts
           TOTAL_WAITS                                      WAIT_CLASS_ID
                               WAIT_CLASS_ID
           TIME_WAITED                                     WAIT_CLASS#
                               WAIT_CLASS#
                               NUM_SESS_WAITING             NUM_SESS_WAITING
v$event_name                   TIME_WAITED                  TIME_WAITED
EVENT#                         WAIT_COUNT                   WAIT_COUNT
EVENT_ID
NAME
PARAMETER1
PARAMETER2
PARAMETER3
WAIT_CLASS_ID
WAIT_CLASS#
WAIT_CLASS


 Wait Events
         v$system_event        v$eventmetric                                           dba_hist_system_event
                                BEGIN_TIME
         EVENT                  END_TIME                                               (Cumulative)
         TOTAL_WAITS            INTSIZE_CSEC
         TOTAL_TIMEOUTS         EVENT_ID                        No in memory history
                                NUM_SESS_WAITING
         TIME_WAITED
                                TIME_WAITED
         AVERAGE_WAIT           WAIT_COUNT
         TIME_WAITED_MICRO
         EVENT_ID


                                                  Copyright 2006 Kyle Hailey                                     #.57
Miscellaneous

   V$sqlstats
   Field naming conventions
   Wait Improvements
     Wait histograms
     Waits in v$session and v$sql
     Waits show the blocker
     Wait history of last 10 waits

   Services
   Client Id


                      Copyright 2006 Kyle Hailey   #.58
v$sqlstats
 More efficient than v$sql or v$sqlarea
 Uses less CPU
 Faster
 Skips many of the latch gets that v$sql does
 Uses Mutexes instead of some latches




                     Copyright 2006 Kyle Hailey   #.59
Event and Stat Fields Names
   Names
                              SQL
      Event
      Statistic                    SQL_ID new hash
      Waitclass                    HASH_VALUE still there
   Ids
      Event#
      Statistic#
      Waitclass#

   Name Hash
      Event_id
      Statistic_id
      Waitclass_id




                      Copyright 2006 Kyle Hailey              #.60
Wait Histograms

V$event_histogram
 1ms to 1 hour buckets
 23 buckets
 < 1 ms, < 2 ms, < 4 ms, < 8 ms, ..., < 2^22
  ms




                  Copyright 2006 Kyle Hailey    #.61
Waits in v$session

 V$session exposes all the fields from v$session_wait
 SEQ#                                               NUMBER
 EVENT#                                             NUMBER
 EVENT                                              VARCHAR2(64)
 P1TEXT                                             VARCHAR2(64)
 P1                                                 NUMBER
 P1RAW                                              RAW(4)
 P2TEXT                                             VARCHAR2(64)
 P2                                                 NUMBER
 P2RAW                                              RAW(4)
 P3TEXT                                             VARCHAR2(64)
 P3                                                 NUMBER
 P3RAW                                              RAW(4)
 WAIT_CLASS_ID                                      NUMBER
 WAIT_CLASS#                                        NUMBER
 WAIT_CLASS                                         VARCHAR2(64)
 WAIT_TIME                                          NUMBER
 SECONDS_IN_WAIT                                    NUMBER
 STATE                                              VARCHAR2(19)



                       Copyright 2006 Kyle Hailey                  #.62
Waits in V$SQL

    SQL_FULLTEXT
    SQL_ID
    FETCHES
    END_OF_FETCH_COUNT
    DIRECT_WRITES
    CONCURRENCY_WAIT_TIME
    APPLICATION_WAIT_TIME
    CLUSTER_WAIT_TIME
    USER_IO_WAIT_TIME
    PLSQL_EXEC_TIME
    JAVA_EXEC_TIME
    CPU_TIME
    ELAPSED_TIME



                    Copyright 2006 Kyle Hailey   #.63
Waits show Blocking Session

V$session. BLOCKING_SESSION -> can build a
  wait tree:




                  Copyright 2006 Kyle Hailey   #.64
Services
 Services is a new way to measure resource usage and
  statistics. A session is associated with a services when the
  session connects to the database via the listener.
 DBMS_SERVICE.CREATE_SERVICE




                        Copyright 2006 Kyle Hailey         #.65
Setting up Services
                         jdbc:oracle:thin:@//server:1521/SERVICE_NAME
dbms_service.CREATE_SERVICE('ora10a',‘A');
dbms_service.START_SERVICE ('ora10a');
-- dbms_service.STOP_SERVICE ('ora10a');
-- dbms_service.DELETE_SERVICE('ora10a');
                                                                    Name
tnsA =                                                              tracked
  (DESCRIPTION =            tnsnames.ora
   (ADDRESS_LIST =
                                                                    in OEM
    (ADDRESS = (PROTOCOL = TCP)
       (HOST = kylehpd)(PORT = 1521)) ) Sqlplus                un/pw@tnsA
   (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = A)
   ) )
                                                         lsnrctl services
Service "A" has 1 instance(s).
 Instance "v10g", status READY, has 1 handler(s) for this service...
  Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
                            Copyright 2006 Kyle Hailey                        #.66
Services in OEM




                             Enable Trace
                                By Service

                            View doesn’t work
         Copyright 2006 Kyle Hailey             #.67
Client Id
 Setting Client ID
  dbms_session.set_identifier(client_id)

 Enabling trace for a client ID
  dbms_monitor.client_id_trace_enable
                   (client_id, TRUE, FALSE)

 Enabling statistics aggregation by client id
 dbms_monitor.client_id_stat_enable(client_id)

 Script to Extract Client Trace
  Trcsess output=<name> client_id=<name> *

                         Copyright 2006 Kyle Hailey   #.68
Session Dedicated
      Scott     John       Sue         Mike        Randy        Tim        Mary




 Oracle
           S1   S2       S3        S4           S4         S5         S6
Sessions
                     Oracle Database Host


                              Copyright 2006 Kyle Hailey                          #.69
Session Dedicated trace
      Scott     John       Sue         Mike        Randy        Tim        Mary




                                   SQL_TRACE=TRUE

 Oracle
           S1   S2       S3        S4           S4         S5         S6
Sessions
                     Oracle Database Host


                              Copyright 2006 Kyle Hailey                          #.70
Session Pooling trace
      Scott       John       Sue         Mike        Randy        Tim        Mary




                                 APP
                                Server
                                  1
  S1, sql_trace=true

 Oracle
           S1    S2        S3        S4           S4         S5         S6      S7
Sessions
                       Oracle Database Host


                                Copyright 2006 Kyle Hailey                           #.71
Session Pooling

      Scott         John       Sue         Mike        Randy        Tim        Mary



  Set client_id =
     SCOTT
                                             dbms_monitor.client_id_trace_enable
                                   APP (client_id, TRUE, FALSE);
                                  Server           waits, binds
                                    1


 Oracle
           S1       S2       S3        S4           S4         S5         S6      S7
Sessions
                         Oracle Database Host


                                  Copyright 2006 Kyle Hailey                           #.72
DB_FILE_MULTI_BLOCK_READ_COUNT
  Auto tuned in 10gR2
  Recommended to leave unset in init.ora, ex, when unset on my PC
        db_file_multiblock_read_count             55
         _db_file_exec_read_count                 55 (IO reads)
        _db_file_optimizer_read_count             8 (optimization)
  When running
      Dbms_stats.gather_system_stats(gathering_mode => ‘interval’
                                              interval     => 30 )
     db_file_multiblock_read_count is ignored
  Alter system reset db_file_multiblock_read_count scope=spfile sid=‘*’;




                                                    Troubleshooting Oracle Performance
                                                    Christian Antognini
                                 Copyright 2006 Kyle Hailey                        #.73
UNDO Retention Auto Tuned
 Oracle10G records the times of the longest-running queries
  and the amount of undo generated to automatically tune the
  UNDO_RETENTION parameter.
 If Autoextend on then undo retention set slightly longer than
  the longest running query
 If autoextend off then depends on free space available
 Bug 5387030 – undo retention miscalculated and UNDO can
  grow, fixed 10.2.0.4
    10.2.0.3 or below can set
    alter system set "_smu_debug_mode" = 33554432




                         Copyright 2006 Kyle Hailey         #.74
SQL Trace Improvement
 dbms_monitor                                                     New 10g

  dbms_monitor.session_trace_enable(session_id => 127,
                                    serial_num => 29,
                                    waits => TRUE,
                                    binds => FALSE)
10gR2 v$session columns
          sql_trace
          sql_trace_waits
          sql_trace_binds
are set when the procedure
session_trace_enable is used and at least one SQL statement has been executed by the
sessionvtraced

 Instead of
              alter session set events ‘10046 trace name context forever, level 12';




                                      Copyright 2006 Kyle Hailey                       #.75
Q1

An ASH report can be run on data covering what time
periods (by default)
a. any 60 seconds in the past week
b. any hour period in the past day
c. any day in the past week
d. any 60 second period in the past hour

                      answers
                      all the above


                        Copyright 2006 Kyle Hailey    #.76
Q2

AWR ( automatic workload repository ) reports on data
covering
what time periods (by default)
a. any 60 seconds in the past week
b. any hour period in the past day
c. any day in the past week
d. any 60 second period in the past hour
     answers
     b and c - AWR only takes data every hour for a week
     by default
                        Copyright 2006 Kyle Hailey         #.77
Q3

Connecting to Oracle is a CPU intensive operation. A high
logon rate
may indicate an application design issue that unnecessarily
burns CPU.
What performance table(s) indicates the time spent
connecting to the database ?
                              b - only
a. v$active_session_history
                              others
b. v$sys_time_model
                              a,c,d - don't report
c. v$waitclassmetric          connection time or connect
d. v$sysstat                  CPU usage

                        Copyright 2006 Kyle Hailey            #.78
Q4

What is the least resource consuming view for getting the
number
of executions of an sql statement

                b - new in 10g, less latch usage than the other
a. v$sqllite    tables
b. v$sqlstats   others
c. v$sql        a doesn't exit
d. v$sqlarea    c reading uses many of the latches as users
                executing sql
                d the worst, like v$sql, but also does an
                expensive group by Hailey
                         Copyright 2006 Kyle                  #.79
Q5

How can you immediately find the top CPU consuming
session in the past 15 seconds


a. v$sessmetric
               answer
b. v$active_session_history
               a, b
c. v$sesstat
               others:
d. v$top_sessions
               c - only has cumulative data, need to take
               deltas of values to see what is happening
              d - doesn't exist

                        Copyright 2006 Kyle Hailey          #.80
Q6

What script runs 16 different queries against
v$active_session_history to
produce a detailed report over any time interval in the AWR
repository
              answer
a. ?/rdbms/admin/spreport.sql
              c
b. ?/rdbms/admin/awrrpt.sql
              other
c. ?/rdbms/admin/ashrpt.sql
d. ?/rdbms/admin/ashreport.sql ASH
              a and b don't use
              d doesn't exit



                        Copyright 2006 Kyle Hailey            #.81
Q7


In 10g, it is recommended to set
db_file_multiblock_read_count to

              answer
a. unset
              a. Oracle will set it automatically to the optimal
b. 8          value
c. 16            (this won't affect SQL optimization as Oracle
              will calculate
d. 32
                 sql optimization with
e. 128
              _db_file_optimizer_read_count         )

                       Copyright 2006 Kyle Hailey            #.82
Q8

Oracle can track different applications using the "services'
identifier.
After the service identifier gets created and started, how
does the
services identifier get set for a connection.
a. call to dbms_services
b. via the tnsnames.ora connection
c. in the init.ora
                                          answer
d. via a middle tier command
                                          b

                           Copyright 2006 Kyle Hailey          #.83
Q9

The identifier "client_id" allows a DBA to monitor what
special situation:
a. track different applications resource usage on a database
b. track application users in session pools
c. track dedicated sessions
d. is the same as the database "username"
             answer
             b - set up specifically to track application users
             that connect without
             a dedicated connection vi a session pool

                         Copyright 2006 Kyle Hailey               #.84

More Related Content

What's hot

Oracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data EditionOracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data EditionJeff Smith
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeCarlos Sierra
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Oracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPMOracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPMArturo Aranda
 
Oracle statistics by example
Oracle statistics by exampleOracle statistics by example
Oracle statistics by exampleMauro Pagano
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizerMauro Pagano
 
[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...
[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...
[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...オラクルエンジニア通信
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder
 
RAC - The Savior of DBA
RAC - The Savior of DBARAC - The Savior of DBA
RAC - The Savior of DBANikhil Kumar
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data StreamingOracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data StreamingMichael Rainey
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationMarkus Michalewicz
 
Oracle Cloud Infrastructure:2023年4月度サービス・アップデート
Oracle Cloud Infrastructure:2023年4月度サービス・アップデートOracle Cloud Infrastructure:2023年4月度サービス・アップデート
Oracle Cloud Infrastructure:2023年4月度サービス・アップデートオラクルエンジニア通信
 
"It can always get worse!" – Lessons Learned in over 20 years working with Or...
"It can always get worse!" – Lessons Learned in over 20 years working with Or..."It can always get worse!" – Lessons Learned in over 20 years working with Or...
"It can always get worse!" – Lessons Learned in over 20 years working with Or...Markus Michalewicz
 
Oracle Database performance tuning using oratop
Oracle Database performance tuning using oratopOracle Database performance tuning using oratop
Oracle Database performance tuning using oratopSandesh Rao
 

What's hot (20)

Oracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data EditionOracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data Edition
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Oracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPMOracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPM
 
Oracle statistics by example
Oracle statistics by exampleOracle statistics by example
Oracle statistics by example
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
 
[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...
[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...
[Oracle DBA & Developer Day 2016] しばちょう先生の特別講義!!ストレージ管理のベストプラクティス ~ASMからExada...
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
 
Oracle GoldenGate導入Tips
Oracle GoldenGate導入TipsOracle GoldenGate導入Tips
Oracle GoldenGate導入Tips
 
OCI GoldenGate Overview 2021年4月版
OCI GoldenGate Overview 2021年4月版OCI GoldenGate Overview 2021年4月版
OCI GoldenGate Overview 2021年4月版
 
RAC - The Savior of DBA
RAC - The Savior of DBARAC - The Savior of DBA
RAC - The Savior of DBA
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data StreamingOracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
Oracle GoldenGate FAQ
Oracle GoldenGate FAQOracle GoldenGate FAQ
Oracle GoldenGate FAQ
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - Presentation
 
Oracle Cloud Infrastructure:2023年4月度サービス・アップデート
Oracle Cloud Infrastructure:2023年4月度サービス・アップデートOracle Cloud Infrastructure:2023年4月度サービス・アップデート
Oracle Cloud Infrastructure:2023年4月度サービス・アップデート
 
"It can always get worse!" – Lessons Learned in over 20 years working with Or...
"It can always get worse!" – Lessons Learned in over 20 years working with Or..."It can always get worse!" – Lessons Learned in over 20 years working with Or...
"It can always get worse!" – Lessons Learned in over 20 years working with Or...
 
Oracle Database performance tuning using oratop
Oracle Database performance tuning using oratopOracle Database performance tuning using oratop
Oracle Database performance tuning using oratop
 

Viewers also liked

Oracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingOracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingKyle Hailey
 
Oracle 10g Performance: chapter 00 intro live_short
Oracle 10g Performance: chapter 00 intro live_shortOracle 10g Performance: chapter 00 intro live_short
Oracle 10g Performance: chapter 00 intro live_shortKyle Hailey
 
Oracle 10g Performance: chapter 00 statspack
Oracle 10g Performance: chapter 00 statspackOracle 10g Performance: chapter 00 statspack
Oracle 10g Performance: chapter 00 statspackKyle Hailey
 
Oracle 10g Performance: chapter 01 ash
Oracle 10g Performance: chapter 01 ashOracle 10g Performance: chapter 01 ash
Oracle 10g Performance: chapter 01 ashKyle Hailey
 
SQL Tuning and VST
SQL Tuning and VST SQL Tuning and VST
SQL Tuning and VST Kyle Hailey
 
Oracle 10g Performance: chapter 05 waits intro
Oracle 10g Performance: chapter 05 waits introOracle 10g Performance: chapter 05 waits intro
Oracle 10g Performance: chapter 05 waits introKyle Hailey
 

Viewers also liked (6)

Oracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingOracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 sampling
 
Oracle 10g Performance: chapter 00 intro live_short
Oracle 10g Performance: chapter 00 intro live_shortOracle 10g Performance: chapter 00 intro live_short
Oracle 10g Performance: chapter 00 intro live_short
 
Oracle 10g Performance: chapter 00 statspack
Oracle 10g Performance: chapter 00 statspackOracle 10g Performance: chapter 00 statspack
Oracle 10g Performance: chapter 00 statspack
 
Oracle 10g Performance: chapter 01 ash
Oracle 10g Performance: chapter 01 ashOracle 10g Performance: chapter 01 ash
Oracle 10g Performance: chapter 01 ash
 
SQL Tuning and VST
SQL Tuning and VST SQL Tuning and VST
SQL Tuning and VST
 
Oracle 10g Performance: chapter 05 waits intro
Oracle 10g Performance: chapter 05 waits introOracle 10g Performance: chapter 05 waits intro
Oracle 10g Performance: chapter 05 waits intro
 

Similar to Oracle 10g Performance: chapter 04 new features

Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOAltinity Ltd
 
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEOClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEOAltinity Ltd
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasKyle Hailey
 
Wait Events 10g
Wait Events 10gWait Events 10g
Wait Events 10gsagai
 
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Tom Diederich
 
Extra performance out of thin air
Extra performance out of thin airExtra performance out of thin air
Extra performance out of thin airKonstantine Krutiy
 
Bending The Curve
Bending The CurveBending The Curve
Bending The Curvefinteligent
 
MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015Mayank Prasad
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Reportnyin27
 
DataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clauseDataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clauseDataStax Academy
 
A deep look at the cql where clause
A deep look at the cql where clauseA deep look at the cql where clause
A deep look at the cql where clauseBenjamin Lerer
 
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaroundGet Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaroundDataGeekery
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASKyle Hailey
 
Innovative Specifications for Better Performance Logging and Monitoring
Innovative Specifications for Better Performance Logging and MonitoringInnovative Specifications for Better Performance Logging and Monitoring
Innovative Specifications for Better Performance Logging and MonitoringCary Millsap
 

Similar to Oracle 10g Performance: chapter 04 new features (20)

ash-1-130820122404-phpapp01.pdf
ash-1-130820122404-phpapp01.pdfash-1-130820122404-phpapp01.pdf
ash-1-130820122404-phpapp01.pdf
 
Intro to ASH
Intro to ASHIntro to ASH
Intro to ASH
 
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
 
Check Constraint In MySQL 8.0
Check Constraint  In MySQL 8.0Check Constraint  In MySQL 8.0
Check Constraint In MySQL 8.0
 
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEOClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
 
Oracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aasOracle 10g Performance: chapter 02 aas
Oracle 10g Performance: chapter 02 aas
 
MySQL under the siege
MySQL under the siegeMySQL under the siege
MySQL under the siege
 
Wait Events 10g
Wait Events 10gWait Events 10g
Wait Events 10g
 
Performance
PerformancePerformance
Performance
 
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
 
Extra performance out of thin air
Extra performance out of thin airExtra performance out of thin air
Extra performance out of thin air
 
Bending The Curve
Bending The CurveBending The Curve
Bending The Curve
 
Php forum2015 tomas_final
Php forum2015 tomas_finalPhp forum2015 tomas_final
Php forum2015 tomas_final
 
MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Report
 
DataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clauseDataStax: A deep look at the CQL WHERE clause
DataStax: A deep look at the CQL WHERE clause
 
A deep look at the cql where clause
A deep look at the cql where clauseA deep look at the cql where clause
A deep look at the cql where clause
 
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaroundGet Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
 
Innovative Specifications for Better Performance Logging and Monitoring
Innovative Specifications for Better Performance Logging and MonitoringInnovative Specifications for Better Performance Logging and Monitoring
Innovative Specifications for Better Performance Logging and Monitoring
 

More from 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
 
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
 
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
 

More from 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
 
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]
 
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
 

Oracle 10g Performance: chapter 04 new features

  • 1. 10g New Performance Features 1. Alerts 2. Metrics 3. AWR ( 7 days of history DBA_HIST_ ) 4. Time Model 5. Wait Classes 6. Misc Copyright 2006 Kyle Hailey #.1
  • 2. Alerts Set select metrics_name alert, In 10g, alerts are warning_operator op, managed in the warning_value warn , database object_name obj from dba_thresholds; ALERT OP WARN ----------------------------------- ---- ------ OBJ ------- Average Users Waiting Counts GT 10 Concurrency Blocked User Session Count GT 0 CPU Time Per User Call GE 8000 db3 Logons Per Sec GE 100 Session Limit % GT 90 Tablespace Space Usage GE 85 Tablespace Space Usage GE 90 SYSTEM Copyright 2006 Kyle Hailey #.2
  • 3. Alerts Outstanding select reason, object_type type, object_name name from dba_outstanding_alerts; REASON TYPE NAME ------------------------------------------ ----------- ------- Tablespace [PERFSTAT] is [97 percent] full TABLESPACE PERFSTA Copyright 2006 Kyle Hailey #.3
  • 4. Alerts Setting DBMS_SERVER_ALERT.SET_THRESHOLD( METRICS_ID => DBMS_SERVER_ALERT.CPU_TIME_PER_CALL, WARNING_OPERATOR => DBMS_SERVER_ALERT.OPERATOR_GE, dbms_server_alert.set_threshold( WARNING_VALUE METRICS_ID => '8000', => dbms_server_alert.tablespace_pct_full, CRITICAL_OPERATOR WARNING_OPERATOR => DBMS_SERVER_ALERT.OPERATOR_GE, => dbms_server_alert.operator_ge, CRITICAL_VALUE WARNING_VALUE => '10000', => 90, OBSERVATION_PERIOD CRITICAL_OPERATOR => 1, => dbms_server_alert.operator_ge, CONSECUTIVE_OCCURRENCES => 2, CRITICAL_VALUE => 99, INSTANCE_NAME OBSERVATION_PERIOD => 'SID', => 1, OBJECT_TYPE CONSECUTIVE_OCCURRENCES => DBMS_SERVER_ALERT.OBJECT_TYPE_SERVICE, => 1, OBJECT_NAME INSTANCE_NAME => 'SID') => null, OBJECT_TYPE => dbms_server_alert.object_type_tablespace, OBJECT_NAME => 'SYSTEM'); http://www.psoug.org/reference/dbms_serv_alert.html Copyright 2006 Kyle Hailey #.4
  • 5. 9i 10g Metrics DBA_HIST_SQLSTAT v$sql v$sql SQL Waits v$system_event v$system_event V$eventmetric V$waitclassmetric V$session_wait Metrics V$session_event V$sesstat v$sysstat v$systat Stats v$session v$session Sessions V$sessmetric V$sysmetric Copyright 2006 Kyle Hailey #.5
  • 6. Metrics  What inspired Metrics?  Alerting  But … metrics make our lives easier  Old statistics were cumulative  Old statistics lacked history Question: What is the IO on the system right now? Copyright 2006 Kyle Hailey #.6
  • 7. First Tedious Step Select value from v$sysstat where name=‘physical reads’; VALUE 1,533,787 Not much help …Why? Let see … Copyright 2006 Kyle Hailey #.7
  • 8. This tells you … Nothing GOOD BAD 1,533,787 30 minutes IO’s 30 minutes time time Copyright 2006 Kyle Hailey #.8
  • 9. Need to do MATH to find Out Take value at time A Take value at time B Delta = (B-A) or Rate = (B-A)/elapsed time Copyright 2006 Kyle Hailey #.9
  • 10. Methods  Oracle 6 Utlbstat.sql/Utlestat.sql  Creates tables, inserts, deletes  Oracle 8 introduced Statspack  Improvement,but needs to be set up and administered (by guess who)  Oracle 10 introduces Metrics (and AWR & OEM) Overkill to run statspack for one or two statistics, now 10g gives us metric tables Copyright 2006 Kyle Hailey #.10
  • 11. Performance Metric Deltas Kinds of Metric Tables 1. Metric – current 2. Metric History – last hour Current Deltas History of Values over last hour V$EVENTMETRIC V$FILEMETRIC_HISTORY V$FILEMETRIC V$SYSMETRIC_HISTORY V$SESSMETRIC V$SERVICEMETRIC_HISTORY V$SERVICEMETRIC V$WAITCLASSMETRIC_HISTORY V$SYSMETRIC V$SYSMETRIC_SUMMARY V$WAITCLASSMETRIC #.11 Copyright 2006 Kyle Hailey
  • 12. Metrics  Intervals  Calculations  15 second  Deltas  60 second  Rates  10 minutes - file IO  per second  30 minutes - sql  per transaction  Ratios  Percentages Copyright 2006 Kyle Hailey #.12
  • 13. Metric Tables Wait Events  V$EVENTMETRIC (60 secs )  V$WAITCLASSMETRIC (60 secs) Statistics  V$SESSMETRIC (15 secs Deltas)  V$SYSMETRIC (15 and 60 secs deltas) Files  V$FILEMETRIC ( 10 minutes) SQL  DBA_HIST_SQLSTAT Copyright 2006 Kyle Hailey #.13
  • 14. Answer at your fingertips GOOD BAD 3 IO/sec X 1,533,787 513 IO/sec 30 minutes IO’s 30 minutes time time Copyright 2006 Kyle Hailey #.14
  • 15. Now What’s the IO? Select VALUE , METRIC_UNIT from v$sysmetric where metric_name='Physical Reads Per Sec‘; VALUE METRIC_UNIT INTSIZE_CSEC 654.6736 Reads Per Second 5959 134.9835 Reads Per Second 1515 Avg IO per sec for the last 15 and 60 secs Copyright 2006 Kyle Hailey #.15
  • 16. v$sysmetric desc v$sysmetric BEGIN_TIME END_TIME INTSIZE_CSEC – interval value in 1/100sec GROUP_ID METRIC_ID METRIC_NAME VALUE METRIC_UNIT Attention: metric_names are different from v$sysstat Copyright 2006 Kyle Hailey #.16
  • 17. v$sysmetric 15 Secs Per Sec and Per Transaction Physical Reads Buffer Cache Hit Ratio Physical Writes Memory Sorts Ratio Physical Reads Direct Execute Without Parse Ratio Redo Generated Logons Soft Parse Ratio User Calls Database CPU Time Ratio Logical Reads Library Cache Hit Ratio Redo Writes Shared Pool Free % Total Table Scans Full Index Scans Txns Per Logon DB Block Gets Consistent Read Gets Per Sec DB Block Changes Consistent Read Changes User Transaction Per Sec Executions Copyright 2006 Kyle Hailey #.17
  • 18. v$sysmetric 60 Sec Buffer Cache Hit Ratio Current Logons Count Memory Sorts Ratio Current Open Cursors Count Redo Allocation Hit Ratio User Limit % User Commits Percentage SQL Service Response Time User Rollbacks Percentage Database Wait Time Ratio Cursor Cache Hit Ratio Database CPU Time Ratio Rows Per Sort Row Cache Hit Ratio Execute Without Parse Ratio Row Cache Miss Ratio Soft Parse Ratio Library Cache Hit Ratio User Calls Ratio Library Cache Miss Ratio Global Cache Average CR Get Time Shared Pool Free % Global Cache Average Current Get Time PGA Cache Hit % Global Cache Blocks Corrupted Process Limit % Global Cache Blocks Lost Session Limit % Txns Per Logon Copyright 2006 Kyle Hailey #.18
  • 19. v$sysmetric 60 Sec Per Second and Transaction Per Sec Physical Reads Disk Sort Physical Writes Enqueue Timeouts User Commits Physical Reads Direct Enqueue Waits User Rollbacks Physical Writes Direct Enqueue Deadlocks User Transaction Physical Reads Direct Lobs Enqueue Requests Physical Writes Direct Lobs DB Block Gets DBWR Checkpoints Redo Generated Consistent Read Gets Background Checkpoints Logons DB Block Changes Network Traffic Volume Open Cursors Consistent Read Changes User Calls CPU Usage Per Transaction Recursive Calls CR Blocks Created Logical Reads CR Undo Records Applied Response Time Redo Writes User Rollback Undo Records Long Table Scans Applied Total Table Scans Leaf Node Splits Full Index Scans Branch Node Splits Total Index Scans PX downgraded 1 to 25% Total Parse Count PX downgraded 25 to 50% Hard Parse Count PX downgraded 50 to 75% Parse Failure Count PX downgraded 75 to 99% . Copyright 2006 Kyle Hailey #.19
  • 20. v$sessmetric desc v$sessmetric BEGIN_TIME • Only 15 second END_TIME Delta INTSIZE_CSEC SESSION_ID SESSION_SERIAL_NUM CPU PHYSICAL_READS PGA_MEMORY HARD_PARSES SOFT_PARSES PHYSICAL_READ_PCT LOGICAL_READ_PCT Copyright 2006 Kyle Hailey #.20
  • 21. Desc v$eventmetric SQL> desc v$eventmetric Name Type ---------------------------------- ------ BEGIN_TIME DATE END_TIME DATE INTSIZE_CSEC NUMBER EVENT# NUMBER EVENT_ID NUMBER NUM_SESS_WAITING NUMBER TIME_WAITED NUMBER WAIT_COUNT NUMBER Copyright 2006 Kyle Hailey #.21
  • 22. Historical Metrics We solved what’s happening now… but  What if your problem happened 10 minutes ago?  How do we get History?  What happened in the past? Copyright 2006 Kyle Hailey #.22
  • 23. Metric History Tables Last 60 minutes of history, in memory v$sysstat physical reads delta delta delta delta delta delta delta 60 secs 60 secs 60 secs 60 secs 60 secs 60 secs 60 secs Copyright 2006 Kyle Hailey #.23
  • 24. Metric History Tables Last hour of statistics at your fingertips : Statistics 3 minutes of 15 second  V$SYSMETRIC_HISTORY deltas  60 seconds for an hour  3 minutes of 15 second  File IO 60 minutes of 1 minute deltas  V$FILEMETRIC_HISTORY  10 minutes for an hour  Waits  V$WAITCLASSMETRIC_HISTORY  60 seconds for an hour Copyright 2006 Kyle Hailey #.24
  • 25. What was IO 30 minutes ago? Select to_char(end_time,'DD-MON-YY HH24:MI'), VALUE , METRIC_UNIT from v$sysmetric_history where METRIC_NAME = 'Physical Reads Per Sec' and END_TIME < ( sysdate - (30/(24*60))) and END_TIME > ( sysdate - (35/(24*60))) order by end_time; TO_CHAR(END_TIM VALUE METRIC_UNIT 08-JAN-08 11:38 118.65 Reads Per Second 08-JAN-08 11:39 76.6166667 Reads Per Second 08-JAN-08 11:40 3.44770153 Reads Per Second 08-JAN-08 11:41 28.7 Reads Per Second 08-JAN-08 11:42 19.6166667 Reads Per Second Copyright 2006 Kyle Hailey #.25
  • 26. V$FILEMETRIC_HISTORY select BEGIN_TIME, FILE_ID, PHYSICAL_READS from V$FILEMETRIC_HISTORY; BEGIN_TI FILE_ID PHYSICAL_READS 04:12:16 1 208 04:12:16 2 600 Physical Reads 04:02:18 1 600 04:02:18 2 189 Broken down by 03:52:15 1 1922 file 03:52:15 2 2082 … Copyright 2006 Kyle Hailey #.26
  • 27. Metric Alerts If Alerts fire on Metrics, then the deltas are kept in historical table for 7 days by default Statistics Not to be confused  DBA_HIST_SYSMETRIC_HISTORY with the other metric  DBA_HIST_SESSMETRIC_HISTORY tables, these only Waits have values when  WAITCLASSMETRIC_HISTORY alerts fire File IO  DBA_HIST_FILEMETRIC_HISTORY Copyright 2006 Kyle Hailey #.27
  • 28. Metrics Family of Tables Stats Waits Files Raw V$sysstat v$system_event v$fileio v$event_histogram v$system_wait_class Now V$sysmetric v$eventmetric v$filemetric V$SYSMETRIC v$waitclassmetric V$SYSMETRIC_SUMMARY V$SESSMETRIC Session : v$sessmetric V$sysmetric_history v$waitclassmetric_history v$filemetric_history V$sysmetric_summary 1 Hour DBA_HIST_WAITCLASSMETRIC_HISTORY DBA_HIST_FILEMETRIC_HISTORY DBA_HIST_SYSMETRIC_HISTORY 7 days DBA_HIST_SESSMETRIC_HISTORY DBA_HIST_SQLSTAT Alerts DBA_HIST_ DBA_HIST_SYSTEM_EVENT only SYSMETRIC_SUMMARY Copyright 2006 Kyle Hailey #.28
  • 29. AWR Automatic Workload Repository  Statspack on Steroids  More efficient than Statspack  More in memory  Less latching  Keeps stats every hour  Stores by default the last 7 days Copyright 2006 Kyle Hailey #.29
  • 30. Snapshoting Done automatically out of the box, but can be run by hand: BEGIN DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); END; / dbms_workload_repository.drop_snapshot_range Copyright 2006 Kyle Hailey #.30
  • 31. DBA_HIST DBA_HIST_DATABASE_INSTANCE DBA_HIST_RESOURCE_LIMIT DBA_HIST_SNAPSHOT DBA_HIST_SHARED_POOL_ADVICE - DBA_HIST_SNAP_ERROR ?DBA_HIST_SQL_WORKAREA_HSTGRM - DBA_HIST_BASELINE DBA_HIST_PGA_TARGET_ADVICE - DBA_HIST_WR_CONTROL ? (work load repository ?) DBA_HIST_INSTANCE_RECOVERY - DBA_HIST_DATAFILE DBA_HIST_JAVA_POOL_ADVICE DBA_HIST_FILESTATXS – only file number, no name DBA_HIST_THREAD - logswitches - DBA_HIST_TEMPFILE -DBA_HIST_STAT_NAME DBA_HIST_TEMPSTATXS – onl;y file number DBA_HIST_SYSSTAT +DBA_HIST_SQLSTAT group by parent cursor plus DELTAs was (stats$sql_summary) -DBA_HIST_SYS_TIME_MODEL DBA_HIST_SQLTEXT -DBA_HIST_OSSTAT_NAME +DBA_HIST_SQL_SUMMARY – identify litterals (was stat$sql_statistics) -DBA_HIST_OSSTAT DBA_HIST_SQL_PLAN DBA_HIST_PARAMETER_NAME -DBA_HIST_SQLBIND DBA_HIST_PARAMETER -DBA_HIST_SQLBIND_META - WRH$_SQL_BIND_METADATA DBA_HIST_SQLBIND_META DBA_HIST_UNDOSTAT -DBA_HIST_OPTIMIZER_ENV DBA_HIST_ROLLSTAT -DBA_HIST_EVENT_NAME DBA_HIST_SEG_STAT DBA_HIST_SYSTEM_EVENT DBA_HIST_SEG_STAT_OBJ – object name DBA_HIST_BG_EVENT_SUMMARY – sum of backgrounds -DBA_HIST_METRIC_NAME DBA_HIST_WAITSTAT -DBA_HIST_SYSMETRIC_HISTORY alert DBA_HIST_ENQUEUE_STAT -DBA_HIST_SYSMETRIC_SUMMARY – max, min, avg standard -DBA_HIST_LATCH_NAME deviation DBA_HIST_LATCH -DBA_HIST_SESSMETRIC_HISTORY alert DBA_HIST_LATCH_CHILDREN -DBA_HIST_FILEMETRIC_HISTORY alert DBA_HIST_LATCH_PARENT -DBA_HIST_WAITCLASSMET_HISTORY alert DBA_HIST_LATCH_MISSES_SUMMARY – summed over parent latch DBA_HIST_DLM_MISC DBA_HIST_LIBRARYCACHE -DBA_HIST_RCVRY_FILE_DEST_STAT DBA_HIST_DB_CACHE_ADVICE -DBA_HIST_RMAN_PERFORMANCE DBA_HIST_BUFFER_POOL_STAT -DBA_HIST_ACTIVE_SESS_HISTORY – every 10th point from DBA_HIST_ROWCACHE_SUMMARY – summed over rowcache entries v$active_session_history DBA_HIST_SGA -DBA_HIST_TABLESPACE_STAT DBA_HIST_SGASTAT -DBA_HIST_LOG DBA_HIST_PGASTAT New in 10g DBA_HIST_MTTR_TARGET_ADVICE -DBA_HIST_TBSPC_SPACE_USAGE - ? Copyright 2006 Kyle Hailey #.31
  • 32. Retention and Interval Defaults:  Hourly snapshots  7 days saved SELECT retention, snap_interval FROM wrm$_wr_control; RETENTION SNAP_INTERVAL +00007 00:00:00.0 +00000 01:00:00.0 Minutes exec dbms_workload_repository.modify_snapshot_settings(14*24*60,30); RETENTION SNAP_INTERVAL +00014 00:00:00.0 +00000 00:30:00.0 Copyright 2006 Kyle Hailey #.32
  • 33. AWR RPT @?/rdbms/admin/awrrpt.sql  Creates Report File  Similar to STATSPACK report  More efficient and more data  HTML or TEXT SELECT * FROM TABLE( dbms_workload_repository.awr_report_text( (select dbid from v$database), 1, 124, -- begin id 125 -- end id )) Copyright 2006 Kyle Hailey #.33
  • 34. AWR Report 1) General info 1) General info 11) Advisories 12) Buffer Pool Stats 12) Buffer Pool Stats 11) Advisories 2) Load Profile 2) Load Profile 1) Buffer pool 13) Wait Stats 13) Wait Stats 1) Buffer pool 3) Wait Events 3) Wait Events 2) PGA 1) Buffer Busy 1) Buffer Busy 2) PGA 4) OS Stats 4) OS Stats 3) Shared Pool 2) Enqueues 2) Enqueues 3) Shared Pool 5) Service Stats 5) Service Stats 4) SGA 12) Undo Stats 12) Undo Stats 4) SGA 6) Top SQL 6) Top SQL 5) Streams 13) Latch Stats 13) Latch Stats 5) Streams 7) SQL Text 7) SQL Text 6) Java 14) Segment Stats 14) Segment Stats 6) Java 8) Instance Statistic 8) Instance Statistic 15) Dictionary Stats 15) Dictionary Stats 9) I/O Stat 9) I/O Stat 16) Library Cache 16) Library Cache 10) Buffer Pool Stats 10) Buffer Pool Stats 17) Memory SGA/PGA 17) Memory SGA/PGA 18) Streams 18) Streams 19) Init.ora 19) Init.ora Copyright 2006 Kyle Hailey #.34
  • 35. Awr 1-13 Copyright 2006 Kyle Hailey #.35
  • 36. AWR 14-26 Copyright 2006 Kyle Hailey #.36
  • 37. AWR Diff SELECT * FROM TABLE( dbms_workload_repository.awr_diff_report_text( (select dbid from v$database), 1, 120, 121, (select dbid from v$database), 1, 122, 123) ); Also : AWR_DIFF_REPORT_HTML Copyright 2006 Kyle Hailey #.37
  • 38. AWR Diff Report in OEM NOTE: Package AWR_DIFF_REPORT_HTML Is different from OEM Its just a tabular output Copyright 2006 Kyle Hailey #.38
  • 39. Also, ADDM report by Hand select dbms_advisor.get_task_report(task_name) from dba_advisor_tasks where task_id = ( select max(t.task_id) from dba_advisor_tasks t, dba_advisor_log l where t.task_id = l.task_id and t.advisor_name = 'ADDM' and l.status = 'COMPLETED'); Set long 100000 Copyright 2006 Kyle Hailey #.39
  • 40. Important AWR Tables  DBA_HIST_SQLSTAT  SQL deltas  DBA_HIST_SEG_STAT  Segment deltas  DBA_HIST_SYSMETRIC_SUMMARY  Stats, max, min, avg  Trending  DBA_HIST_ACTIVE_SESS_HISTORY  ASH  DBA_HIST_SYSTEM_EVENT  Waits dba_hist_sqltext – get sql text from AWR Copyright 2006 Kyle Hailey #.40
  • 41. DBA_HIST_SNAPSHOT SQL> desc DBA_HIST_SNAPSHOT Name Type ------------------- ----------------------- SNAP_ID NUMBER DBID NUMBER INSTANCE_NUMBER NUMBER STARTUP_TIME TIMESTAMP(3) BEGIN_INTERVAL_TIME TIMESTAMP(3) END_INTERVAL_TIME TIMESTAMP(3) FLUSH_ELAPSED INTERVAL DAY(5) TO SECOND(1) SNAP_LEVEL NUMBER ERROR_COUNT NUMBER Copyright 2006 Kyle Hailey #.41
  • 42. DBA_HIST_SQLSTAT SNAP_ID FETCHES_DELTA DBID END_OF_FETCH_COUNT_DELTA INSTANCE_NUMBER SORTS_DELTA SQL_ID EXECUTIONS_DELTA PX_SERVERS_EXECS_DELTA PLAN_HASH_VALUE LOADS_DELTA OPTIMIZER_COST INVALIDATIONS_DELTA OPTIMIZER_MODE PARSE_CALLS_DELTA OPTIMIZER_ENV_HASH_VALUE DISK_READS_DELTA SHARABLE_MEM BUFFER_GETS_DELTA LOADED_VERSIONS ROWS_PROCESSED_DELTA VERSION_COUNT CPU_TIME_DELTA MODULE ELAPSED_TIME_DELTA ACTION IOWAIT_DELTA SQL_PROFILE CLWAIT_DELTA APWAIT_DELTA FORCE_MATCHING_SIGNATURE CCWAIT_DELTA PARSING_SCHEMA_ID DIRECT_WRITES_DELTA PARSING_SCHEMA_NAME PLSEXEC_TIME_DELTA BIND_DATA JAVEXEC_TIME_DELTA Copyright 2006 Kyle Hailey #.42
  • 43. DBA_HIST_SEG_STAT Gets reset every DB bounce SQL> desc DBA_HIST_SEG_STAT PHYSICAL_WRITES_TOTAL PHYSICAL_WRITES_DELTA Name PHYSICAL_READS_DIRECT_TOTAL SNAP_ID PHYSICAL_READS_DIRECT_DELTA DBID PHYSICAL_WRITES_DIRECT_TOTAL INSTANCE_NUMBER PHYSICAL_WRITES_DIRECT_DELTA TS# ITL_WAITS_TOTAL OBJ# ITL_WAITS_DELTA DATAOBJ# ROW_LOCK_WAITS_TOTAL LOGICAL_READS_TOTAL ROW_LOCK_WAITS_DELTA LOGICAL_READS_DELTA SPACE_USED_TOTAL BUFFER_BUSY_WAITS_TOTAL SPACE_USED_DELTA BUFFER_BUSY_WAITS_DELTA SPACE_ALLOCATED_TOTAL DB_BLOCK_CHANGES_TOTAL SPACE_ALLOCATED_DELTA DB_BLOCK_CHANGES_DELTA TABLE_SCANS_TOTAL PHYSICAL_READS_TOTAL TABLE_SCANS_DELTA PHYSICAL_READS_DELTA Copyright 2006 Kyle Hailey #.43
  • 44. DBA_HIST_SYSTEM_EVENT SQL> desc DBA_HIST_SYSTEM_EVENT Name Type ---------------------------------- SNAP_ID NUMBER DBID NUMBER INSTANCE_NUMBER NUMBER EVENT_ID NUMBER EVENT_NAME VARCHAR2(64) WAIT_CLASS_ID NUMBER WAIT_CLASS VARCHAR2(64) TOTAL_WAITS NUMBER TOTAL_TIMEOUTS NUMBER TIME_WAITED_MICRO NUMBER Cumulative Values – can use LAG function Copyright 2006 Kyle Hailey #.44
  • 45. Average Wait Times select btime, (time_ms_end-time_ms_beg)/nullif(count_end-count_beg,0) avg_ms from ( select to_char(s.BEGIN_INTERVAL_TIME,'DD-MON-YY HH24:MI') btime, total_waits count_end, time_waited_micro/1000 time_ms_end, Lag (e.time_waited_micro/1000) ( OVER( PARTITION BY e.event_name ORDER BY s.snap_id) time_ms_beg, Lag (e.total_waits) ( OVER( PARTITION BY e.event_name ORDER BY s.snap_id) count_beg from DBA_HIST_SYSTEM_EVENT e, DBA_HIST_SNAPSHOT s where BTIME AVG_MS s.snap_id=e.snap_id -------------------- ------------ and e.event_name= '&1' 08-JAN-08 01:00 1.017 order by begin_interval_time 08-JAN-08 02:00 .720 ) 08-JAN-08 03:00 .621 order by btime; 08-JAN-08 04:00 1.747 08-JAN-08 05:00 1.046 08-JAN-08 06:00 1.444 Copyright 2006 Kyle Hailey #.45
  • 46. ASH RPT  @?/rdbms/admin/ashrpt  Detailed report on top SQL, Sessions, Objects etc  Run over SQL*Net with select output from table(dbms_workload_repository.ash_report_text( (select dbid from v$database), 1, sysdate – 2/24, sysdate – 1/24, 0)) ;  Also ASH_REPORT_HTML Copyright 2006 Kyle Hailey #.46
  • 47. ASH RPT 1) General info 1) General info 9) Top SQL using literals 9) Top SQL using literals 2) Top User Events *** 2) Top User Events *** 10) Top Sessions *** 10) Top Sessions *** 3) Top Background Events 3) Top Background Events 11) Top Blocking Sessions 11) Top Blocking Sessions 4) Top Event P1/P2/P3 Values 4) Top Event P1/P2/P3 Values 12) Top Sessions running PQs 12) Top Sessions running PQs 5) Top Service/Module 5) Top Service/Module 13) Top DB Objects 13) Top DB Objects 6) Top Client IDs 6) Top Client IDs 14) Top DB Files 14) Top DB Files 7) Top SQL Command Types 7) Top SQL Command Types 15) Top Latches 15) Top Latches 8) Top SQL Statements *** 8) Top SQL Statements *** 16) Activity Over Time *** 16) Activity Over Time *** Copyright 2006 Kyle Hailey #.47
  • 48. ASH RPT HTML Copyright 2006 Kyle Hailey #.48
  • 49. Time Model New concept • DB Time Time Model Total time for all database calls • cpu time SQL Wait • wait time Metrics Stats Sessions Copyright 2006 Kyle Hailey #.49
  • 50. Time Model areas  Total Time  CPU  Updated every 5 seconds  Elapsed Time  SQL execution  Plsql execution (sql execute subtracted out)  Java execution  Connection time  Probablythe most important as it points out problems with too many logons/sec Copyright 2006 Kyle Hailey #.50
  • 51. Time Model Components 1) background elapsed time 2) background cpu time 1) DB time 2) DB CPU 2) connection management call elapsed time 2) sequence load elapsed time 2) sql execute elapsed time 2) parse time elapsed 3) hard parse elapsed time 4) hard parse (sharing criteria) elapsed time 5) hard parse (bind mismatch) elapsed time 3) failed parse elapsed time 4) failed parse (out of shared memory) elapsed time 2) PL/SQL execution elapsed time 2) inbound PL/SQL rpc elapsed time 2) PL/SQL compilation elapsed time 2) Java execution elapsed time Copyright 2006 Kyle Hailey #.51
  • 52. Total Time DB CPU DB Wait Time DB CPU ~ DB Total Database Wait Time Time Time Time Parse Elapsed Time Copyright 2006 Kyle Hailey #.52
  • 53. Hard Parse Bind Mismatch hard parse (bind mismat hard ch) parse elapsed hard (sharing time parse criteria) Parse elapse elapsed time d time time elapsed Copyright 2006 Kyle Hailey #.53
  • 54. Time Model Tables Current cumulative values  V$SYS_TIME_MODEL  V$SESS_TIME_MODEL AWR Snapshots of cumulative values  DBA_HIST_SYS_TIME_MODEL Tables show cumulative values. To find deltas, then need to run AWR report (no time model metric tables  ) Copyright 2006 Kyle Hailey #.54
  • 55. Wait Classes  Administrative (39)  Configuration (20)  switch logfile  log file size  rebuild index  Enqueues: ST, HW, ITL  Latch: redo copy,shared pool  Application (11)  Idle (56)  enqueues sqlnet break/reset  Network (25)   Cluster (113)  Commit (1)  System I/O (19)  Log file Sync  Scheduler (6)  Concurrency (12)  User I/O (12)  Latches: cbc, lbc,   Lib cache locks Buffer busy wait  Other (485) Copyright 2006 Kyle Hailey #.55
  • 56. Wait Class Tables v$system_wait_class  cumulative v$waitclassmetric  Current rates v$waitclassmetric_history  Hour of rates (60 second intervals) Copyright 2006 Kyle Hailey #.56
  • 57. Waits Metrics Cumulative Current deltas Last Hour Last 7 days Wait v$system_wait_class Classes v$waitclassmetric v$waitclassmetric_history dba_hist_ WAIT_CLASS_ID BEGIN_TIME BEGIN_TIME waitclassmetric_history WAIT_CLASS# END_TIME END_TIME WAIT_CLASS INTSIZE_CSEC INTSIZE_CSEC Only gets populated with alerts TOTAL_WAITS WAIT_CLASS_ID WAIT_CLASS_ID TIME_WAITED WAIT_CLASS# WAIT_CLASS# NUM_SESS_WAITING NUM_SESS_WAITING v$event_name TIME_WAITED TIME_WAITED EVENT# WAIT_COUNT WAIT_COUNT EVENT_ID NAME PARAMETER1 PARAMETER2 PARAMETER3 WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS Wait Events v$system_event v$eventmetric dba_hist_system_event BEGIN_TIME EVENT END_TIME (Cumulative) TOTAL_WAITS INTSIZE_CSEC TOTAL_TIMEOUTS EVENT_ID No in memory history NUM_SESS_WAITING TIME_WAITED TIME_WAITED AVERAGE_WAIT WAIT_COUNT TIME_WAITED_MICRO EVENT_ID Copyright 2006 Kyle Hailey #.57
  • 58. Miscellaneous  V$sqlstats  Field naming conventions  Wait Improvements  Wait histograms  Waits in v$session and v$sql  Waits show the blocker  Wait history of last 10 waits  Services  Client Id Copyright 2006 Kyle Hailey #.58
  • 59. v$sqlstats  More efficient than v$sql or v$sqlarea  Uses less CPU  Faster  Skips many of the latch gets that v$sql does  Uses Mutexes instead of some latches Copyright 2006 Kyle Hailey #.59
  • 60. Event and Stat Fields Names  Names SQL  Event  Statistic SQL_ID new hash  Waitclass HASH_VALUE still there  Ids  Event#  Statistic#  Waitclass#  Name Hash  Event_id  Statistic_id  Waitclass_id Copyright 2006 Kyle Hailey #.60
  • 61. Wait Histograms V$event_histogram  1ms to 1 hour buckets  23 buckets  < 1 ms, < 2 ms, < 4 ms, < 8 ms, ..., < 2^22 ms Copyright 2006 Kyle Hailey #.61
  • 62. Waits in v$session  V$session exposes all the fields from v$session_wait SEQ# NUMBER EVENT# NUMBER EVENT VARCHAR2(64) P1TEXT VARCHAR2(64) P1 NUMBER P1RAW RAW(4) P2TEXT VARCHAR2(64) P2 NUMBER P2RAW RAW(4) P3TEXT VARCHAR2(64) P3 NUMBER P3RAW RAW(4) WAIT_CLASS_ID NUMBER WAIT_CLASS# NUMBER WAIT_CLASS VARCHAR2(64) WAIT_TIME NUMBER SECONDS_IN_WAIT NUMBER STATE VARCHAR2(19) Copyright 2006 Kyle Hailey #.62
  • 63. Waits in V$SQL  SQL_FULLTEXT  SQL_ID  FETCHES  END_OF_FETCH_COUNT  DIRECT_WRITES  CONCURRENCY_WAIT_TIME  APPLICATION_WAIT_TIME  CLUSTER_WAIT_TIME  USER_IO_WAIT_TIME  PLSQL_EXEC_TIME  JAVA_EXEC_TIME  CPU_TIME  ELAPSED_TIME Copyright 2006 Kyle Hailey #.63
  • 64. Waits show Blocking Session V$session. BLOCKING_SESSION -> can build a wait tree: Copyright 2006 Kyle Hailey #.64
  • 65. Services  Services is a new way to measure resource usage and statistics. A session is associated with a services when the session connects to the database via the listener.  DBMS_SERVICE.CREATE_SERVICE Copyright 2006 Kyle Hailey #.65
  • 66. Setting up Services jdbc:oracle:thin:@//server:1521/SERVICE_NAME dbms_service.CREATE_SERVICE('ora10a',‘A'); dbms_service.START_SERVICE ('ora10a'); -- dbms_service.STOP_SERVICE ('ora10a'); -- dbms_service.DELETE_SERVICE('ora10a'); Name tnsA = tracked (DESCRIPTION = tnsnames.ora (ADDRESS_LIST = in OEM (ADDRESS = (PROTOCOL = TCP) (HOST = kylehpd)(PORT = 1521)) ) Sqlplus un/pw@tnsA (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = A) ) ) lsnrctl services Service "A" has 1 instance(s). Instance "v10g", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready Copyright 2006 Kyle Hailey #.66
  • 67. Services in OEM Enable Trace By Service View doesn’t work Copyright 2006 Kyle Hailey #.67
  • 68. Client Id  Setting Client ID dbms_session.set_identifier(client_id)  Enabling trace for a client ID dbms_monitor.client_id_trace_enable (client_id, TRUE, FALSE)  Enabling statistics aggregation by client id dbms_monitor.client_id_stat_enable(client_id)  Script to Extract Client Trace Trcsess output=<name> client_id=<name> * Copyright 2006 Kyle Hailey #.68
  • 69. Session Dedicated Scott John Sue Mike Randy Tim Mary Oracle S1 S2 S3 S4 S4 S5 S6 Sessions Oracle Database Host Copyright 2006 Kyle Hailey #.69
  • 70. Session Dedicated trace Scott John Sue Mike Randy Tim Mary SQL_TRACE=TRUE Oracle S1 S2 S3 S4 S4 S5 S6 Sessions Oracle Database Host Copyright 2006 Kyle Hailey #.70
  • 71. Session Pooling trace Scott John Sue Mike Randy Tim Mary APP Server 1 S1, sql_trace=true Oracle S1 S2 S3 S4 S4 S5 S6 S7 Sessions Oracle Database Host Copyright 2006 Kyle Hailey #.71
  • 72. Session Pooling Scott John Sue Mike Randy Tim Mary Set client_id = SCOTT dbms_monitor.client_id_trace_enable APP (client_id, TRUE, FALSE); Server waits, binds 1 Oracle S1 S2 S3 S4 S4 S5 S6 S7 Sessions Oracle Database Host Copyright 2006 Kyle Hailey #.72
  • 73. DB_FILE_MULTI_BLOCK_READ_COUNT  Auto tuned in 10gR2  Recommended to leave unset in init.ora, ex, when unset on my PC  db_file_multiblock_read_count 55  _db_file_exec_read_count 55 (IO reads)  _db_file_optimizer_read_count 8 (optimization)  When running  Dbms_stats.gather_system_stats(gathering_mode => ‘interval’ interval => 30 ) db_file_multiblock_read_count is ignored  Alter system reset db_file_multiblock_read_count scope=spfile sid=‘*’; Troubleshooting Oracle Performance Christian Antognini Copyright 2006 Kyle Hailey #.73
  • 74. UNDO Retention Auto Tuned  Oracle10G records the times of the longest-running queries and the amount of undo generated to automatically tune the UNDO_RETENTION parameter.  If Autoextend on then undo retention set slightly longer than the longest running query  If autoextend off then depends on free space available  Bug 5387030 – undo retention miscalculated and UNDO can grow, fixed 10.2.0.4  10.2.0.3 or below can set  alter system set "_smu_debug_mode" = 33554432 Copyright 2006 Kyle Hailey #.74
  • 75. SQL Trace Improvement  dbms_monitor New 10g dbms_monitor.session_trace_enable(session_id => 127, serial_num => 29, waits => TRUE, binds => FALSE) 10gR2 v$session columns sql_trace sql_trace_waits sql_trace_binds are set when the procedure session_trace_enable is used and at least one SQL statement has been executed by the sessionvtraced Instead of alter session set events ‘10046 trace name context forever, level 12'; Copyright 2006 Kyle Hailey #.75
  • 76. Q1 An ASH report can be run on data covering what time periods (by default) a. any 60 seconds in the past week b. any hour period in the past day c. any day in the past week d. any 60 second period in the past hour answers all the above Copyright 2006 Kyle Hailey #.76
  • 77. Q2 AWR ( automatic workload repository ) reports on data covering what time periods (by default) a. any 60 seconds in the past week b. any hour period in the past day c. any day in the past week d. any 60 second period in the past hour answers b and c - AWR only takes data every hour for a week by default Copyright 2006 Kyle Hailey #.77
  • 78. Q3 Connecting to Oracle is a CPU intensive operation. A high logon rate may indicate an application design issue that unnecessarily burns CPU. What performance table(s) indicates the time spent connecting to the database ? b - only a. v$active_session_history others b. v$sys_time_model a,c,d - don't report c. v$waitclassmetric connection time or connect d. v$sysstat CPU usage Copyright 2006 Kyle Hailey #.78
  • 79. Q4 What is the least resource consuming view for getting the number of executions of an sql statement b - new in 10g, less latch usage than the other a. v$sqllite tables b. v$sqlstats others c. v$sql a doesn't exit d. v$sqlarea c reading uses many of the latches as users executing sql d the worst, like v$sql, but also does an expensive group by Hailey Copyright 2006 Kyle #.79
  • 80. Q5 How can you immediately find the top CPU consuming session in the past 15 seconds a. v$sessmetric answer b. v$active_session_history a, b c. v$sesstat others: d. v$top_sessions c - only has cumulative data, need to take deltas of values to see what is happening d - doesn't exist Copyright 2006 Kyle Hailey #.80
  • 81. Q6 What script runs 16 different queries against v$active_session_history to produce a detailed report over any time interval in the AWR repository answer a. ?/rdbms/admin/spreport.sql c b. ?/rdbms/admin/awrrpt.sql other c. ?/rdbms/admin/ashrpt.sql d. ?/rdbms/admin/ashreport.sql ASH a and b don't use d doesn't exit Copyright 2006 Kyle Hailey #.81
  • 82. Q7 In 10g, it is recommended to set db_file_multiblock_read_count to answer a. unset a. Oracle will set it automatically to the optimal b. 8 value c. 16 (this won't affect SQL optimization as Oracle will calculate d. 32 sql optimization with e. 128 _db_file_optimizer_read_count ) Copyright 2006 Kyle Hailey #.82
  • 83. Q8 Oracle can track different applications using the "services' identifier. After the service identifier gets created and started, how does the services identifier get set for a connection. a. call to dbms_services b. via the tnsnames.ora connection c. in the init.ora answer d. via a middle tier command b Copyright 2006 Kyle Hailey #.83
  • 84. Q9 The identifier "client_id" allows a DBA to monitor what special situation: a. track different applications resource usage on a database b. track application users in session pools c. track dedicated sessions d. is the same as the database "username" answer b - set up specifically to track application users that connect without a dedicated connection vi a session pool Copyright 2006 Kyle Hailey #.84

Editor's Notes

  1. To effectively diagnose performance problems, statistics must be available. Oracle generates many types of cumulative statistics for the system, sessions, and individual SQL statements. Oracle also tracks cumulative statistics on segments and services. When analyzing a performance problem in any of these scopes, you typically look at the change in statistics (delta value) over the period of time you are interested in. Specifically, you look at the difference between the cumulative value of a statistic at the start of the period and the cumulative value at the end. Cumulative values for statistics are generally available through dynamic performance views, such as the V$SESSTAT and V$SYSSTAT views. Note that the cumulative values in dynamic views are reset when the database instance is shutdown. The Automatic Workload Repository (AWR) automatically persists the cumulative and delta values for most of the statistics at all levels except the session level. This process is repeated on a regular time period and the result is called an AWR snapshot. The delta values captured by the snapshot represent the changes for each statistic over the time period. See &quot;Automatic Workload Repository&quot; . Another type of statistic collected by Oracle is called a metric. A metric is defined as the rate of change in some cumulative statistic. That rate can be measured against a variety of units, including time, transactions, or database calls. For example, the number database calls per second is a metric. Metric values are exposed in some V$ views, where the values are the average over a fairly small time interval, typically 60 seconds. A history of recent metric values is available through V$ views, and some of the data is also persisted by AWR snapshots. A third type of statistical data collected by Oracle is sampled data. This sampling is performed by the active session history (ASH) sampler. ASH samples the current state of all active sessions. This data is collected into memory and can be accessed by a V$ view. It is also written out to persistent store by the AWR snapshot processing. See &quot;Active Session History (ASH)&quot; .
  2. /* DBA_THRESHOLDS METRICS_NAME WARNING_OPERATOR WARNING_VALUE CRITICAL_OPERATOR CRITICAL_VALUE OBSERVATION_PERIOD CONSECUTIVE_OCCURRENCES INSTANCE_NAME OBJECT_TYPE OBJECT_NAME STATUS */ col op for a4 col warn for a6 col alert for a35 col obj for a15 select metrics_name alert, warning_operator op, warning_value warn , object_name obj from dba_thresholds /
  3. var SERV varchar2(20); exec :SERV := &apos;db3&apos;; begin DBMS_SERVER_ALERT.SET_THRESHOLD( METRICS_ID =&gt; DBMS_SERVER_ALERT.CPU_TIME_PER_CALL, WARNING_OPERATOR =&gt; DBMS_SERVER_ALERT.OPERATOR_GE, WARNING_VALUE =&gt; &apos;8000&apos;, CRITICAL_OPERATOR =&gt; DBMS_SERVER_ALERT.OPERATOR_GE, CRITICAL_VALUE =&gt; &apos;10000&apos;, OBSERVATION_PERIOD =&gt; 1, CONSECUTIVE_OCCURRENCES =&gt; 2, INSTANCE_NAME =&gt; :serv, OBJECT_TYPE =&gt; DBMS_SERVER_ALERT.OBJECT_TYPE_SERVICE, OBJECT_NAME =&gt; :serv ) ; end; / set serveroutput on DECLARE vWarnOp NUMBER(10); vWarnVal VARCHAR2(100); vCritOp NUMBER(10); vCritVal VARCHAR2(100); vObsvPer NUMBER(5); vConOcur NUMBER(5); BEGIN dbms_server_alert.get_threshold( METRICS_ID =&gt; DBMS_SERVER_ALERT.CPU_TIME_PER_CALL, WARNING_OPERATOR =&gt; vWarnOp, WARNING_VALUE =&gt; vWarnVal, CRITICAL_OPERATOR =&gt; vCritOp, CRITICAL_VALUE =&gt; vCritVal, OBSERVATION_PERIOD =&gt; vObsvPer, CONSECUTIVE_OCCURRENCES =&gt; vConOcur, INSTANCE_NAME =&gt; :serv, OBJECT_TYPE =&gt; DBMS_SERVER_ALERT.OBJECT_TYPE_SERVICE, OBJECT_NAME =&gt; :serv ) ; dbms_output.put_line(&apos;WarnOp: &apos; || TO_CHAR(vWarnOp)); dbms_output.put_line(&apos;WarnVal: &apos; || vWarnVal); dbms_output.put_line(&apos;CritOp: &apos; || TO_CHAR(vCritOp)); dbms_output.put_line(&apos;CritVal: &apos; || vCritVal); dbms_output.put_line(&apos;Observation: &apos; || vObsvper); dbms_output.put_line(&apos;Occurences: &apos; || vConOcur); END; /
  4. Some exceptions logons current opened cursors current
  5. 10 minutes and 30 minutes in special cases 10 minutes for File IO 30 minutes for SQL – metric values are constantly increasing in x$ until 30 minute snapshot when it is externalized into dba_hist_sqlstat – SQL is a separate thing from metrics. Metrics are all stored in the same base x$ structure V$sysmetric is not a 1 to 1 map of v$sysstat, there are some new values and reduced set of systats made into per sec and per transaction metrics V$METRIC V$METRIC_HISTORY Combined view onto the other metric tables V$METRICGROUP V$METRICNAME V$SYSMETRIC V$SESSMETRIC V$FILEMETRIC V$EVENTMETRIC V$WAITCLASSMETRIC V$SVCMETRIC V$SYSMETRIC_HISTORY V$FILEMETRIC_HISTORY V$WAITCLASSMETRIC_HISTORY V$SVCMETRIC_HISTORY V$SYSMETRIC_SUMMARY
  6. SQL x$kewrtsqlstat (30 minutes) Session V$sessmetric BEGIN_TIME END_TIME INTSIZE_CSEC SESSION_ID SESSION_SERIAL_NUM CPU PHYSICAL_READS PGA_MEMORY HARD_PARSES SOFT_PARSES PHYSICAL_READ_PCT LOGICAL_READ_PCT Group ID 2 is a superset of 3 4 is a superset of 5 Event class metrics SQL&gt; select metric_id, metric_name , metric_unit from v$metricname where group_id=0; METRIC_ID METRIC_NAME METRIC_UNIT --------- ---------------------------------------- -------------------- 0 Number of Sessions Waiting (Event) number of sessions 1 Total Time Waited cent-seconds 2 Total Wait Counts number of waits SQL&gt; select metric_id, metric_name , metric_unit from v$metricname where group_id=1; METRIC_ID METRIC_NAME METRIC_UNIT --------- -------------------------------- -------------------- 1000 Average Users Waiting Counts # of users 1001 Database Time Spent Waiting (%) % 1003 Total Time Waited centi-seconds 1002 Total Wait Counts number of waits Session Metrics -------------------- SQL&gt; select group_id, metric_id, metric_name , metric_unit from v$metricname where group_id in (4,5); GROUP_ID METRIC_ID METRIC_NAME METRIC_UNIT -------- --------- ---------------------------------------- -------------------- 4 4000 Blocked User Session Count num of sessions 5 5000 User Transaction Count (Session) num of transactions 5 5001 CPU Time (Session) centi-seconds 5 5002 Physical Reads (Session) num of reads 5 5003 PGA Memory (Session) num of bytes 5 5004 Hard Parse Count (Session) num of parses 5 5005 Total Parse Count (Session) num of parses 5 5006 Physical Reads Ratio (Sess/Sys) % in % 5 5007 Logical Reads Ratio (Sess/Sys) % in % Service and File Metrics ------------------------------ SQL&gt; select group_id, metric_id, metric_name , metric_unit from v$metricname where group_id in (6,7) GROUP_ID METRIC_ID METRIC_NAME METRIC_UNIT -------- --------- ---------------------------------------- ------------------------- 6 6000 Elapsed Time Per User Call Microseconds per call 6 6001 CPU Time Per User Call Microseconds per call 7 7000 Average File Read Time (Files-Long) centi-secs per read 7 7001 Average File Write Time (Files-Long) centi-secs per Write 7 7002 Physical Reads (Files-Long) counts 7 7003 Physical Writes (Files-Long) counts 7 7004 Physical Block Reads (Files-Long) counts 7 7005 Physical Block Writes (Files-Long) counts 1* select * from v$metricgroup GID NAME INTS M_INT GROUP_ID COUNT(*) --- ----------------------------------- ------ ----- -------- ---------- 0 Event Metrics 6000 1 0 3 1 Event Class Metrics 6000 60 1 4 2 System Metrics Long Duration 6000 60 2 114 3 System Metrics Short Duration 1500 12 3 40 4 Session Metrics Long Duration 6000 60 4 1 5 Session Metrics Short Duration 1500 1 5 8 6 Service Metrics 6000 60 6 2 7 File Metrics Long Duration 60000 6 7 6 Max Interval Ie, v$sysmetric_history keeps the last hour for long duration deltas, 60s, and the last 3 minutes for short duration, 15 second deltas
  7. Buffer Cache Hit Ratio Memory Sorts Ratio Execute Without Parse Ratio Soft Parse Ratio Database CPU Time Ratio Library Cache Hit Ratio Shared Pool Free % Txns Per Logon Per Sec User Transaction Per Sec Per Sec and Per Transaction Physical Reads Physical Writes Physical Reads Direct Redo Generated Logons User Calls Logical Reads Redo Writes Total Table Scans Full Index Scans DB Block Gets Consistent Read Gets DB Block Changes Consistent Read Changes Executions
  8. Buffer Cache Hit Ratio Memory Sorts Ratio Redo Allocation Hit Ratio User Commits Percentage User Rollbacks Percentage Cursor Cache Hit Ratio Rows Per Sort Execute Without Parse Ratio Soft Parse Ratio User Calls Ratio Global Cache Average CR Get Time Global Cache Average Current Get Time Global Cache Blocks Corrupted Global Cache Blocks Lost Current Logons Count Current Open Cursors Count User Limit % SQL Service Response Time Database Wait Time Ratio Database CPU Time Ratio Row Cache Hit Ratio Row Cache Miss Ratio Library Cache Hit Ratio Library Cache Miss Ratio Shared Pool Free % PGA Cache Hit % Process Limit % Session Limit % Txns Per Logon Per Sec User Commits User Rollbacks User Transaction DBWR Checkpoints Background Checkpoints Network Traffic Volume Per Transaction Response Time Per Second and Transaction Physical Reads Physical Writes Physical Reads Direct Physical Writes Direct Physical Reads Direct Lobs Physical Writes Direct Lobs Redo Generated Logons Open Cursors User Calls Recursive Calls Logical Reads Redo Writes Long Table Scans Total Table Scans Full Index Scans Total Index Scans Total Parse Count Hard Parse Count Parse Failure Count Disk Sort Enqueue Timeouts Enqueue Waits Enqueue Deadlocks Enqueue Requests DB Block Gets Consistent Read Gets DB Block Changes Consistent Read Changes CPU Usage CR Blocks Created CR Undo Records Applied User Rollback Undo Records Applied Leaf Node Splits Branch Node Splits PX downgraded 1 to 25% PX downgraded 25 to 50% PX downgraded 50 to 75% PX downgraded 75 to 99%
  9. V$sessmetric BEGIN_TIME END_TIME INTSIZE_CSEC SESSION_ID SESSION_SERIAL_NUM CPU PHYSICAL_READS PGA_MEMORY HARD_PARSES SOFT_PARSES PHYSICAL_READ_PCT LOGICAL_READ_PCT
  10. Buffer Cache Hit Ratio Memory Sorts Ratio Redo Allocation Hit Ratio User Commits Percentage User Rollbacks Percentage Cursor Cache Hit Ratio Rows Per Sort Execute Without Parse Ratio Soft Parse Ratio User Calls Ratio Global Cache Average CR Get Time Global Cache Average Current Get Time Global Cache Blocks Corrupted Global Cache Blocks Lost Current Logons Count Current Open Cursors Count User Limit % SQL Service Response Time Database Wait Time Ratio Database CPU Time Ratio Row Cache Hit Ratio Row Cache Miss Ratio Library Cache Hit Ratio Library Cache Miss Ratio Shared Pool Free % PGA Cache Hit % Process Limit % Session Limit % Txns Per Logon Per Sec User Commits User Rollbacks User Transaction DBWR Checkpoints Background Checkpoints Network Traffic Volume Per Transaction Response Time Per Second and Transaction Physical Reads Physical Writes Physical Reads Direct Physical Writes Direct Physical Reads Direct Lobs Physical Writes Direct Lobs Redo Generated Logons Open Cursors User Calls Recursive Calls Logical Reads Redo Writes Long Table Scans Total Table Scans Full Index Scans Total Index Scans Total Parse Count Hard Parse Count Parse Failure Count Disk Sort Enqueue Timeouts Enqueue Waits Enqueue Deadlocks Enqueue Requests DB Block Gets Consistent Read Gets DB Block Changes Consistent Read Changes CPU Usage CR Blocks Created CR Undo Records Applied User Rollback Undo Records Applied Leaf Node Splits Branch Node Splits PX downgraded 1 to 25% PX downgraded 25 to 50% PX downgraded 50 to 75% PX downgraded 75 to 99%
  11. Waits V$WAITCLASSMETRIC_HISTORY ( 60 seconds) (V$SESSION_WAIT_HISTORY 10 events) (V$ACTIVE_SESSION_HISTORY 30minutes, roughly)
  12. SQL DBA_HIST_SQLSTAT Alerts -DBA_HIST_SYSMETRIC_HISTORY - WRH$_SYSMETRIC_SUMMARY -DBA_HIST_SESSMETRIC_HISTORY -DBA_HIST_FILEMETRIC_HISTORY - WRH$_FILEMETRIC_HISTORY -DBA_HIST_WAITCLASSMET_HISTORY All values -DBA_HIST_SYSMETRIC_SUMMARY – max, min, avg standard deviation -DBA_HIST_SYSTEM_EVENT - wrh$_system_event
  13. Not doing multiple scans on v$sql Not capturing as much data from v$sql Statspack was based on thresholds AWR is based on work done in the last interval FUNCTION ASH_REPORT_HTML / ASH_REPORT_TEXT FUNCTION AWR_REPORT_HTML / AWR_REPORT_TEXT FUNCTION AWR_DIFF_REPORT_HTML / AWR_DIFF_REPORT_TEXT FUNCTION AWR_SQL_REPORT_HTML / AWR_SQL_REPORT_TEXT PROCEDURE CREATE_SNAPSHOT PROCEDURE CREATE_BASELINE PROCEDURE DROP_BASELINE PROCEDURE DROP_SNAPSHOT_RANGE PROCEDURE MODIFY_SNAPSHOT_SETTINGS
  14. SQL&gt; desc DBA_HIST_SEG_STAT Name ------------------------------- SNAP_ID DBID INSTANCE_NUMBER TS# OBJ# DATAOBJ# LOGICAL_READS_TOTAL LOGICAL_READS_DELTA BUFFER_BUSY_WAITS_TOTAL BUFFER_BUSY_WAITS_DELTA DB_BLOCK_CHANGES_TOTAL DB_BLOCK_CHANGES_DELTA PHYSICAL_READS_TOTAL PHYSICAL_READS_DELTA PHYSICAL_WRITES_TOTAL PHYSICAL_WRITES_DELTA PHYSICAL_READS_DIRECT_TOTAL PHYSICAL_READS_DIRECT_DELTA PHYSICAL_WRITES_DIRECT_TOTAL PHYSICAL_WRITES_DIRECT_DELTA ITL_WAITS_TOTAL ITL_WAITS_DELTA ROW_LOCK_WAITS_TOTAL ROW_LOCK_WAITS_DELTA GC_CR_BLOCKS_SERVED_TOTAL GC_CR_BLOCKS_SERVED_DELTA GC_CU_BLOCKS_SERVED_TOTAL GC_CU_BLOCKS_SERVED_DELTA GC_BUFFER_BUSY_TOTAL GC_BUFFER_BUSY_DELTA GC_CR_BLOCKS_RECEIVED_TOTAL GC_CR_BLOCKS_RECEIVED_DELTA GC_CU_BLOCKS_RECEIVED_TOTAL GC_CU_BLOCKS_RECEIVED_DELTA SPACE_USED_TOTAL SPACE_USED_DELTA SPACE_ALLOCATED_TOTAL SPACE_ALLOCATED_DELTA TABLE_SCANS_TOTAL
  15. column avg_ms for 999,999.999
  16. Session Time Model SQL&gt; select STAT_NAME, value from V$SESS_TIME_MODEL where sid=1; DB time 143 DB CPU 290000 background cpu time 0 sequence load elapsed time 0 parse time elapsed 0 hard parse elapsed time 0 sql execute elapsed time 0 global cache cr block receive time 0 global cache current block receive time 0 global cache get time 0 connection management call elapsed time 0 failed parse elapsed time 0 hard parse (sharing criteria) elapsed time 0 hard parse (bind mismatch) elapsed time 0 PL/SQL execution elapsed time 0 inbound PL/SQL rpc elapsed time 0 PL/SQL compilation elapsed time 0 Java execution elapsed time 0 bind/define call elapsed time 0 cluster wait time 0 concurrency wait time 0 application wait time 0 user I/O wait time 0 System time model SQL&gt; select STAT_NAME, value from V$SYS_TIME_MODEL; DB time 3.9837E+10 DB CPU 2.4055E+10 background cpu time 2.1808E+10 sequence load elapsed time 15939410 parse time elapsed 451760577 hard parse elapsed time 178851736 sql execute elapsed time 3.6900E+10 connection management call elapsed time 1045589383 failed parse elapsed time 848439 hard parse (sharing criteria) elapsed time 3347865 hard parse (bind mismatch) elapsed time 1515268 PL/SQL execution elapsed time 418089534 inbound PL/SQL rpc elapsed time 0 PL/SQL compilation elapsed time 37666077 Java execution elapsed time 0 bind/define call elapsed time 0
  17.      2) parse time elapsed            3) hard parse elapsed time                 4) hard parse (sharing criteria) elapsed time                      5) hard parse (bind mismatch) elapsed time
  18. 800 waits in 10g Latchs and locks have been broken out into their own waits Ie latch: redo copy enqueue: CI SQL&gt; select * from v$system_wait_class; WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS TOTAL_WAITS TIME_WAITED ------------- ----------- -------------------- ----------- ----------- 1893977003 0 Other 11695 1873612 4217450380 1 Application 9316 850799 3290255840 2 Configuration 1949 2379 4166625743 3 Administrative 3 475 3875070507 4 Concurrency 184 634 3386400367 5 Commit 6260 1423 2723168908 6 Idle 1531734 530987091 2000153315 7 Network 127231 1709 1740759767 8 User I/O 1037623 16561 4108307767 9 System I/O 268085 150502
  19. SQL&gt; column name format a20 SQL&gt; select 2 en.wait_class name, 3 average_waiter_count awc, 4 dbtime_in_wait dbt, 5 time_waited, 6 wait_count 7 from 8 v$waitclassmetric wcm, 9 ( select distinct wait_class#, wait_class from v$event_name) en 10 where 11 wcm.wait_class# = en.wait_class# 12 / NAME AWC DBT TIME_WAITED WAIT_COUNT -------------------- ---------- ---------- ----------- ---------- Other 0 4 12 1 Application 0 0 0 7 Configuration 0 0 1 2 Administrative 0 0 0 0 Concurrency 0 0 0 0 Commit 0 0 1 2 Idle 17 0 104965 278 Network 0 0 0 50 User I/O 0 3 10 614 System I/O 0 10 33 81 Scheduler 0 0 0 0 NAME AWC DBT TIME_WAITED WAIT_COUNT -------------------- ---------- ---------- ----------- ---------- Cluster 0 0 0 0
  20. V$WAITCLASSMETRIC, V$WAITCLASSMETRIC_HISTORY CLASS_ID -&gt; WAIT_CLASS_ID Add WAIT_CLASS# column
  21. V$EVENT_HISTOGRAM V$EVENT_HISTOGRAM displays a histogram of the number of waits, the maximum wait, and total wait time on an event basis. The histogram has buckets of time intervals from &lt; 1 ms, &lt; 2 ms, &lt; 4 ms, &lt; 8 ms, ... &lt; 2^21 ms, &lt; 2^22 ms, = 2^22 ms. The histogram will not be filled unless the TIMED_STATISTICS initialization parameter is set to true . Column Datatype Description EVENT# NUMBER Event number EVENT VARCHAR2(64) Name of the Event WAIT_TIME_MILLI NUMBER Amount of time the bucket represents (in milliseconds). If the duration = num , then this column represents waits of duration &lt; num that are not included in any smaller bucket. WAIT_COUNT NUMBER Number of waits of the duration belonging to the bucket of the histogram The wait histograms (from v$event_histogram) are a time based histograms for each wait event. The histogram consists of 23 buckets  from  1ms to 1 hour ( 1,2,4, ..., 2^22), and each bucket contains the number of times a wait as lasted less than that amount of time and more than the previous bucket, for example, select * from v$event_histogram where event#=588;     EVENT# EVENT                               WAIT_TIME_MILLI WAIT_COUNT ---------- ----------------------------------- --------------- ----------        588 SQL*Net message from client                       1        373        588 SQL*Net message from client                       2       1936        588 SQL*Net message from client                       4        792        588 SQL*Net message from client                       8        416        588 SQL*Net message from client                      16         64        588 SQL*Net message from client                      32         58        588 SQL*Net message from client                      64          6        588 SQL*Net message from client                     128          6        588 SQL*Net message from client                     256          2        588 SQL*Net message from client                     512          5        588 SQL*Net message from client                    1024          0        588 SQL*Net message from client                    2048          1        588 SQL*Net message from client                    4096          9        588 SQL*Net message from client                    8192         21        588 SQL*Net message from client                   16384         22        588 SQL*Net message from client                   32768         19        588 SQL*Net message from client                   65536         14        588 SQL*Net message from client                  131072          7        588 SQL*Net message from client                  262144          5        588 SQL*Net message from client                  524288          2        588 SQL*Net message from client                 1048576          3        588 SQL*Net message from client                 2097152          3        588 SQL*Net message from client                 4194304          1 SQL*Net message from client is the idle time where the Oracle connection (session) has no work to do. For example if you run SQLplus and then go get a coffee, the Oracle connected session is idle. Thus the histogram will count how many times you were idle and for how long. For an sqlplus connection this isn&apos;t very important, but for and automated application, this can be an indication of how much time the application is working verses how much time the database is working. Here is another example        292 db file sequential read                           1    1170075        292 db file sequential read                           2       1881        292 db file sequential read                           4        726        292 db file sequential read                           8        389        292 db file sequential read                          16        393        292 db file sequential read                          32         85        292 db file sequential read                          64         57        292 db file sequential read                         128         60        292 db file sequential read                         256         31        292 db file sequential read                         512          2        292 db file sequential read                        1024          4 These waits are IO from disk. The first bucket represents 1ms IOs, which is impossibly quick. The explanation is that the IOs are coming from UNIX memory  not from disk. This indicates that it might be better to increase the buffer cache since it would be better to have Oracle managing the caching of Oracle blocks than the OS, plus all the reads into the Oracle cache cost resources. The above table also shows slow IOs. There are 94 IO&apos;s above 32ms which is slow but compared to over 1 million IO waits is a very small percentage, but actually a large percentage of the wait time due to IO.
  22. And an even quicker one on 9i systems and above is: select row_wait_obj#, sw.event from v$session_wait sw, v$session s where sw.event in (&apos;db file scattered read&apos;, &apos;db file sequential read&apos;) and sw.sid=s.sid And in 10g, the session wait data is all available in v$session, just: select row_wait_obj#, event from v$session s where event in (&apos;db file scattered read&apos;, &apos;db file sequential read&apos;) &gt; select &gt;      objd , &gt;      event &gt;  from &gt;      v$bh bh, &gt;      v$session_wait sw &gt;  where &gt;       file#=p1 and block#=p2 and &gt;      event in (&apos;db file scattered read&apos;, &apos;db file sequential read&apos;);
  23. trcsess [output=&lt;output file name &gt;] [session=&lt;session ID&gt;] [clientid=&lt;clientid&gt;] [service=&lt;service name&gt;] [action=&lt;action name&gt;] [module=&lt;module name&gt;] &lt;trace file names&gt;
  24. From Tim Gorman MBRC used rather than db_file_multiblock_read_count If db_file_multiblock_read_count &gt; MBRC used to derive _db_file_ optimizer_ read_count If db_file_multiblock_read_count &lt;= MBRC _db_file_ optimizer _read_count is default If no workload stats db_file_multiblock_read_count used to set _db_file_ optimizer_ read_count and affects optimizer decision db_file_multiblock_read_count 55 _db_file_exec_read_count 55 _db_file_optimizer_read_count 8
  25. Bug 5387030 - Automatic tuning of undo_retention causes unusual extra space allocation Doc ID: Note:5387030.8