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
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
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
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
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
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
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
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
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
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
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
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 "Automatic Workload Repository" . 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 "Active Session History (ASH)" .
/* 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 /
Some exceptions logons current opened cursors current
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
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> 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> 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> 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> 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
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
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%
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%
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
Session Time Model SQL> 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> 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
2) parse time elapsed 3) hard parse elapsed time 4) hard parse (sharing criteria) elapsed time 5) hard parse (bind mismatch) elapsed time
800 waits in 10g Latchs and locks have been broken out into their own waits Ie latch: redo copy enqueue: CI SQL> 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
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 < 1 ms, < 2 ms, < 4 ms, < 8 ms, ... < 2^21 ms, < 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 < 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'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'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.
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 ('db file scattered read', 'db file sequential read') 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 ('db file scattered read', 'db file sequential read') > select > objd , > event > from > v$bh bh, > v$session_wait sw > where > file#=p1 and block#=p2 and > event in ('db file scattered read', 'db file sequential read');
From Tim Gorman MBRC used rather than db_file_multiblock_read_count If db_file_multiblock_read_count > MBRC used to derive _db_file_ optimizer_ read_count If db_file_multiblock_read_count <= 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
Bug 5387030 - Automatic tuning of undo_retention causes unusual extra space allocation Doc ID: Note:5387030.8