Sei sulla pagina 1di 16

Knowledge Document

Tower name: ORACLE

Submitted By: Biplab K. Parida


Month Year: March - 2019

Document Détails

Project Name LDC

Account LDC

Current Version

List of Contributors Biplab K. Parida

Customer Contact Information

Revision History
Date of Reviewed
Version Description Author Approved By
Revision By

Here are Some of the Queries to keep Handy for troubleshooting when we have high load issues and
need to capture all details as mentioned below.

This version will help in finding the table with STALE stats AND gives you the command to collect the
stale stats for (Table without partition & Table with Partitions).

1) Check load on server and Resource stats

uptime

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';


set lines 200
set pages 200
break on report
compute sum of count(1) on report
select machine,status,count(1),max(logon_time) from v$session group by machine,status order
by 3,2,1 ;

set lines 200


select * from v$resource_limit;

2) Get Active query with high number of sessions and running long time by looking at
max(last_call_et) , Target for SQLID with high number of sessions first and secondly
max(last_call_et)

select sql_id,count(1),max(last_call_et) from v$session where status='ACTIVE' and sql_id is not


null group by sql_id having count(1) > 1 order by 2;

select sql_id,event,status,count(*),max(last_call_et) from v$session where status='ACTIVE'


group by sql_id,Event,status having count(*)>2 order by 4;

3) All waits for the issue Query – check for latches which causes system slowness

select event, sql_id, count(*)


from v$active_session_history
where sql_id like nvl('&sql_id',sql_id)
group by event, sql_id
order by 3 desc,event;

From History – if above does not work


set lines 155
col avg_time_waited for 999,999.99
select event, sql_id, count(*),
avg(time_waited) avg_time_waited
from DBA_HIST_ACTIVE_SESS_HISTORY
where event like nvl('&event',event)
and sql_id like nvl('&sql_id',sql_id)
group by event, sql_id
order by event, 3
/

4) Get the SQL Full Text

set long 6000


col SQL_TEXT for a500
col SQL_FULLTEXT for a800
SELECT SQL_ID,SQL_FULLTEXT FROM v$sql WHERE sql_id='&SQL_ID';

Or
From History – if above does not work
SELECT SQL_TEXT FROM DBA_HIST_SQLTEXT WHERE SQL_ID='&sqlid';

5) Get Query current statistics like current plan, buffer gets / Version count / no of executions /
Invalidations

SELECT
sql_id,plan_hash_value,hash_value,buffer_gets,DISK_READS,rows_processed,executions,elapse
d_Time / (1000000 * decode(executions,0,1, executions) ) etime_per_exec,
LOADS,INVALIDATIONS,PARSE_CALLS,LOADED_VERSIONS,VERSION_COUNT,(cpu_time/1000000
)/60 "CPU time In Mins"
FROM v$sqlarea
WHERE sql_id = '&SQL_ID';

OR

SELECT
sql_id,plan_hash_value,hash_value,buffer_gets,DISK_READS,rows_processed,executions,elapse
d_Time / (1000000 * decode(executions,0,1, executions) ) etime_per_exec,
LOADS,INVALIDATIONS,PARSE_CALLS,LOADED_VERSIONS,(cpu_time/1000000)/60 "CPU time In
Mins"
FROM v$sql
WHERE sql_id = '&SQL_ID';

To know How many Child cursors are used by SQLID


select child_number,executions,parse_calls,loads,invalidations from v$sql where sql_id =
'&sqlid';

6) Monitor the SQLID if it’s completed successfully or completed with error ,below shows SQL
start time and what Plan value was used.

set lines 200 pages 200


col sql_text for a50
col username for a12
col sid for 9999
col key for 99999999999999
col module for a15

select key, sid, username,SQL_EXEC_START,sql_id,module,status, sql_plan_hash_value


plan_hash, elapsed_time, cpu_time, buffer_gets, disk_reads, substr(sql_text,1,50) sql_text
from v$sql_monitor
where STATUS like '%EXECUTING%'
--AND sql_id = '&sqlid'
--and MODULE=’AdhocReport’
order by cpu_time;

7) Check the Execution Plan is changed.


set lines 155
col execs for 999,999,999
col avg_etime for 999,999.999
col avg_lio for 999,999,999,999.9
col begin_interval_time for a30
col node for 99999
break on plan_hash_value on startup_time skip 1
select ss.snap_id, ss.instance_number node, begin_interval_time, sql_id, plan_hash_value,
nvl(executions_delta,0) execs,
(elapsed_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta))/1000000
avg_etime,
(buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta)) avg_lio
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS
where sql_id = nvl('&sql_id','4dqs2k5tynk61')
and ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and executions_delta > 0
order by 1
/

8) Kill sessions coming from the SQLID , specifically Selects

select 'alter system kill session '||''''||s.SID||','||s.SERIAL#||''' Immediate;' "KillSessions"


from v$session s,v$process p
where s.paddr=p.addr
and s.sql_id= '&sql_id'
and s.username is not null
order by s.sid,LOGON_TIME;

9) After killing Flush the SQLID from shared pool

BEGIN
FOR r IN (SELECT address,
hash_value
FROM v$sqlarea
WHERE sql_id ='&SQL_ID')
LOOP
sys.dbms_shared_pool.purge(r.address || ',' || r.hash_value, 'C');
END LOOP;
END;
/

10) Check the table stats are current or old Or STALE

(a) Spool the plan in a.log as below


spool a.log
SELECT * FROM TABLE(dbms_xplan.display_awr('&sql_id'));
spool off

(b) Copy the required plan to text file plan.txt to find required tables/indexes used by the query
as below.

!cat a.log |grep "|" > plan.txt

(c) Find tables from plan.txt : !cat plan.txt |grep -i table|cut -d'|' -f4|sort|uniq|awk '{print
"["$1"[,"}' |sed "s/\[/\'/g"

Find indexes from plan.txt : !cat plan.txt |grep -i index|cut -d'|' -f4|sort|uniq |awk
'{print "["$1"[,"}' |sed "s/\[/\'/g"

-- Quick way to find owner of objects


col OBJECT_OWNER for a20
col OBJECT_TYPE for a15
col OBJECT_NAME for a30
col OPTIMIZER for a20
col OPTIONS for a25
select sql_id,PLAN_HASH_VALUE,OBJECT_OWNER,''''||OBJECT_NAME||''','
OBJECT_NAME,OBJECT_TYPE,OPTIMIZER,OPTIONS from v$sql_plan where sql_id='&sqlid' and
OBJECT_NAME is not null;

OR

Set line 200


col STALE_STATS for a10
col PART_POSN for 9999
col TABLE_NAME for a30
select
OWNER,TABLE_NAME,STALE_STATS,USER_STATS,NUM_ROWS,to_char(LAST_ANALYZED,'DD-
MON-YY HH24:MI:SS') LAST_ANALYZED ,PARTITION_NAME,PARTITION_POSITION PART_POSN
from dba_tab_statistics
where (owner,TABLE_NAME) in
(select OBJECT_OWNER,OBJECT_NAME from v$sql_plan
where sql_id='&sql_id' and OBJECT_OWNER is not null)
--AND STALE_STATS='YES'
order by NUM_ROWS;

OWNER TABLE_NAME STALE_STAT


USE NUM_ROWS
LAST_ANALYZED PARTITION_NAME PART_POSN
------------------------------ ------------------------------ ----------
--- ---------- --------------------------- ------------------------------ -----
----
DC5PRD_SWISSCOMPROD FORM_TEMPLATE NO
NO 12 24-JAN-15 07:50:12
DC5PRD_SWISSCOMPROD FORM_DATA NO
NO 109181 05-MAR-15 00:16:13
DC5PRD_SWISSCOMPROD ROUTE_ENTRY NO
NO 466844 04-MAR-15 01:41:48
DC5PRD_SWISSCOMPROD ROUTE_STEP_LOCAL NO
NO 1647403 04-MAR-15 01:47:09
DC5PRD_SWISSCOMPROD TMP_BA_COND
NO

(d) Now use the table name and index names to check stats update time and if they are Stale

What percent of data change , table becomes STALE ?

SELECT dbms_stats.get_prefs('stale_percent') FROM dual;

Check Stale Stats on tables


=============================
Note : if the table is partitioned you will see the partition name as well.

Set line 200


col STALE_STATS for a10
col PART_POSN for 9999
col TABLE_NAME for a30
select
OWNER,TABLE_NAME,STALE_STATS,USER_STATS,NUM_ROWS,to_char(LAST_ANALYZED,'DD
-MON-YY HH24:MI:SS') LAST_ANALYZED ,PARTITION_NAME,PARTITION_POSITION
PART_POSN
from dba_tab_statistics
where upper(owner)=upper('EUSFV4_TELUSP')
and TABLE_NAME in
(
'FB_EXT',
'FEEDBACK',
'FORM_DATA',
'FORM_TEMPLATE',
'TMP_BA_COND',
'USERS_INFO',
'USERS_SYSINFO',
'USER_CUSTOMFIELD'
)
--AND STALE_STATS='YES'
order by NUM_ROWS;

Check Stale Stats on Indexes


=============================
col STALE_STATS for a10
col PART_POSN for 9999
col TABLE_NAME for a30
col OWNER for a15
col TABLE_OWNER for a15
Select
OWNER,
INDEX_NAME,
TABLE_OWNER,
TABLE_NAME,
STALE_STATS ,
USER_STATS,
NUM_ROWS,
to_char(LAST_ANALYZED,'DD-MON-YY HH24:MI:SS') LAST_ANALYZED ,
PARTITION_NAME,
PARTITION_POSITION PART_POSN
from dba_ind_statistics
where upper(owner)=upper('EUSFV4_TELUSP')
and INDEX_NAME in
(
'FB_FDATAID',
'FDATA_SUBJ',
'IDX_FB_EXT_IID_DID',
'IDX_FDATA_MULTI',
'PK_USERS_INFO',
'PK_USERS_SYSINFO',
'USER_CUSTOMFIELD_PK'
)
--AND STALE_STATS='YES'
order by NUM_ROWS;

Last Analyzed tables


========================
select OWNER,TABLE_NAME,NUM_ROWS,to_char(LAST_ANALYZED,'DD-MON-YY
HH24:MI:SS') LAST_ANALYZED,PARTITIONED
from dba_tables
where owner='EUSFV4_TELUSP'
and TABLE_NAME in
(
'FB_EXT',
'FEEDBACK',
'FORM_DATA',
'FORM_TEMPLATE',
'TMP_BA_COND',
'USERS_INFO',
'USERS_SYSINFO',
'USER_CUSTOMFIELD'
);

Indexes Last analyzed


=============================
set line 200
col owner for a10
col COLUMN_NAME for a25
col TABLE_NAME for a30
col INDEX_NAME for a27
col COLUMN_NAME for a30
col INDEX_OWNER for a10
col INDEX_TYPE for a12
col TABLE_OWNER for a10
SELECT
TABLE_OWNER,TABLE_NAME,OWNER,INDEX_NAME,INDEX_TYPE,status,to_char(LAST_ANA
LYZED,'DD-MON-YY HH24:MI:SS') LAST_ANALYZED,PARTITIONED,BLEVEL
FROM DBA_INDEXES WHERE owner='EUSFV4_TELUSP'
AND INDEX_NAME in
(
'FB_FDATAID',
'FDATA_SUBJ',
'IDX_FB_EXT_IID_DID',
'IDX_FDATA_MULTI',
'PK_USERS_INFO',
'PK_USERS_SYSINFO',
'USER_CUSTOMFIELD_PK'
);

11) Check High Inserts or Updates

select * from dba_tab_modifications where TABLE_OWNER='SYS' and TABLE_NAME='TAB$';

12) Gather Stats for the Stale Tables ,below will generate commands to collect stats

Note : if table have partitions, then they need to separately collect stats, so select the below
command accordingly.

Set line 200


col OUTPUT for a1000

For Table without Partition

select 'exec
DBMS_STATS.GATHER_TABLE_STATS(ownname=>'''||OWNER||''',tabname=>'''||TABLE_NAME
||''',estimate_percent=>dbms_stats.auto_sample_size,degree=>'||DECODE(TRUNC(DECODE(NV
L(num_rows,0),0,1,num_rows)/250000),0,1,4)||',cascade=>TRUE);' output
from dba_tab_statistics
where upper(owner)=upper('EUSFV4_TELUSP')
and TABLE_NAME in
(
'JBM_MSG_REF',
'JBM_MSG'
)
AND STALE_STATS='YES'
and PARTITION_NAME is null
order by table_name;

IF Partitions are STALE Use below

select 'exec DBMS_STATS.GATHER_TABLE_STATS(ownname=>'''||OWNER


||''',tabname=>'''||TABLE_NAME||''',partname=>'''||PARTITION_NAME||''',cascade=>TRUE);'
output
from dba_tab_statistics
where upper(owner)=upper('EUSFV4_TELUSP')
and TABLE_NAME in
(
'GENERIC_OBJECT_T',
'GENERIC_RELATIONSHIP'
)
AND STALE_STATS='YES'
and PARTITION_NAME is not null
order by table_name;

13) History of table stats update time

set line 200


select OWNER,table_name,PARTITION_NAME,to_char(stats_update_time,'mm/dd/yy
hh24:mi:ss')
from DBA_tab_stats_history
where upper(owner)=upper('EUSFV4_TELUSP')
and TABLE_NAME in
(
'FB_EXT',
'FEEDBACK',
'FORM_DATA',
'FORM_TEMPLATE',
'TMP_BA_COND',
'USERS_INFO',
'USERS_SYSINFO',
'USER_CUSTOMFIELD'
)
order by table_name,stats_update_time;

14) Get ASH report for the issue timing

define dbid = ''; -- NULL defaults to current database


define inst_num = ''; -- NULL defaults to current instance
define report_type = 'html'; -- 'text' for TEXT
define begin_time = '10/21/14 15:00:00'; --MM/DD/YY HH24:MI:SS
define duration = '180'; --3 hrs
define report_name = '/tmp/sql_ashrpt.html';
define slot_width = '1';
define target_session_id = '';
define target_sql_id = '9xs18nyppapsc';
define target_wait_class = '';
define target_service_hash = '';
define target_module_name = '';
define target_action_name = '';
define target_client_id = '';
define target_plsql_entry = '';
@?/rdbms/admin/ashrpti

uuencode /tmp/sql_ashrpt.html /tmp/sql_ashrpt.html' |mailx –s ash


malesh.lingayya.gummula@sap.com

15) Check Invalid Indexes

select owner,index_name,TABLE_NAME,NUM_ROWS,LAST_ANALYZED,STATUS from


dba_indexes where upper(owner)=upper('&owner') and status not in ('VALID','N/A');

select
INDEX_OWNER,INDEX_NAME,PARTITION_NAME,SUBPARTITION_COUNT,LAST_ANALYZED,STAT
US from dba_ind_partitions where INDEX_OWNER=upper('&owner') and status <> 'USABLE';

16) Run Tuning Advisors

@$ORACLE_HOME/rdbms/admin/sqltrpt.sql

17) Run SQL Monitoring Report

(a)
set long 1000000000
set pages 0

spool sqlmon.html

select
DBMS_SQLTUNE.REPORT_SQL_MONITOR(sql_id=>'&sqlid',session_id=>&SID,session_serial=>&SRLN
O,type=>'HTML') as report
from dual;
spool off

(B) @$ORACLE_HOME/rdbms/admin/awrsqrpt.sql -- Standard SQL statement Report


18) Check Buffer cache Memory Shrinkages

(A) History
set linesize 200
col VALUE format a30
col BEGIN_INTERVAL_TIME for a30
col PARAMETER_NAME for a18
set line 200
select p.SNAP_ID,t.BEGIN_INTERVAL_TIME,p.PARAMETER_NAME,p.VALUE/1024/1024 "MB"
,p.VALUE/1024/1024/1024 "GB"
from DBA_HIST_PARAMETER p,DBA_HIST_SNAPSHOT t
where p.SNAP_ID=t.SNAP_ID
and p.PARAMETER_NAME in ('db_cache_size','shared_pool_size')
order by p.SNAP_ID,p.PARAMETER_NAME;

(B) Current Memory


select NAME,BYTES/1024/1024 "MB",BYTES/1024/1024/1024 "GB" from v$sgainfo where NAME in
('Buffer Cache Size','Shared Pool Size');
NAME MB GB
-------------------------------- ---------- ----------
Buffer Cache Size 15744 15.375
Shared Pool Size 31360 30.625

(C) _ Memory parameters

col Parameter format a35 wrap


col "Session Value MB" format 999,999,999
col "Instance Value MB" format 999,999,999
select a.ksppinm "Parameter",
b.ksppstvl/1024/1024 "Session Value MB",
c.ksppstvl/1024/1024 "Instance Value MB"
from x$ksppi a, x$ksppcv b, x$ksppsv c
where a.indx = b.indx and a.indx = c.indx
and a.ksppinm in ('__shared_pool_size','__streams_pool_size',
'__db_cache_size','__java_pool_size','__large_pool_size',
'_large_pool_min_alloc','_shared_pool_reserved_min',
'_shared_pool_reserved_min_alloc','_shared_pool_reserved_pct'
)
order by 1;

(D) Check Buffer cache Advisory

column c1 heading 'Cache Size (meg)' format 999,999,999,999


column c2 heading 'Buffers' format 999,999,999
column c3 heading 'Estd Phys|Read Factor' format 999.90
column c4 heading 'Estd Phys| Reads' format 999,999,999,999,99
set pages 30
select
size_for_estimate c1,
buffers_for_estimate c2,
estd_physical_read_factor c3,
estd_physical_reads c4
from
v$db_cache_advice
where
name = 'DEFAULT'
and
block_size = (SELECT value FROM V$PARAMETER
WHERE name = 'db_block_size')
and
advice_status = 'ON';

The output from the script is shown below. The values range from ten percent of the current size to
double the current size of the db_cache_size.
Estd Phys Estd Phys
Cache Size (meg) Buffers Read Factor Reads
---------------- ------------ ----------- -------------------
1,536 189,384 8.97 592,735,205,16 
10% Size
3,072 378,768 7.41 489,705,479,65
4,608 568,152 5.87 388,170,249,59
6,144 757,536 4.70 310,600,273,49
7,680 946,920 3.72 246,154,829,53
9,216 1,136,304 2.94 193,988,318,54
10,752 1,325,688 2.30 151,783,912,70
12,288 1,515,072 1.79 118,600,852,23
13,824 1,704,456 1.41 93,101,898,84
15,360 1,893,840 1.11 73,482,050,46
16,128 1,988,532 1.00 66,095,324,29 
Current Size = 15744 MB => from above step B
16,896 2,083,224 .89 58,648,599,72
18,432 2,272,608 .72 47,531,212,36
19,968 2,461,992 .59 39,291,898,81
21,504 2,651,376 .51 33,384,465,72
23,040 2,840,760 .44 29,018,921,05
24,576 3,030,144 .39 25,837,395,19
26,112 3,219,528 .35 23,435,255,12
27,648 3,408,912 .33 21,585,740,14
29,184 3,598,296 .30 20,112,622,31
30,720 3,787,680 .29 18,881,183,78 
<== 2x size

21 rows selected.

From the above listing, it is clear that increasing the db_cache_size from 16,128
MB to 16,896 MB would result in approximately 744,672,457 less physical reads.

(E) Check PGA Advisory

http://www.toadworld.com/platforms/oracle/w/wiki/619.monitoring-pga-in-10g.aspx

select name,round(value/1024/1024,2) "In MB",round(value/1024/1024/1024,2) "In GB"


from v$pgastat
where name in ('aggregate PGA target parameter',
'aggregate PGA auto target',
'total PGA inuse',
'total PGA allocated');

NAME In MB In
GB
---------------------------------------------------------------- ---------- -------
---
aggregate PGA target
parameter 20480 20  show
parameter pga
aggregate PGA auto
target 17229.93 16.83
total PGA
inuse 1398.87 1.37
total PGA
allocated 2587.91 2.53 
check advisory below

Cache hit
As a rule of thumb, the PGA cache hit percentage should be higher than 60%

Col value for 999,999,999,999,999


col name for a40
select name,value
from v$pgastat
where name in ('over allocation count',
'extra bytes read/written',
'cache hit percentage');

NAME VALUE
---------------------------------------- --------------------
over allocation count 0
extra bytes read/written 6,704,489,669,632
cache hit percentage 99

select round(pga_target_for_estimate/1024/1024) as est_mb,pga_target_factor as factor,


round(bytes_processed/1024/1024) as p_mb,round(estd_extra_bytes_rw/1024/1024) as extra_mb,
estd_pga_cache_hit_percentage as hit_ratio,estd_overalloc_count as est_over from
v$pga_target_advice;

TARGET_EST_MB FACTOR P_MB EXTRA_MB HIT_RATIO EST_OVER


------------- ---------- ---------- ---------- ---------- ----------
2560 .125 944932507 89147 100 353
5120 .25 944932507 6006 100 0
10240 .5 944932507 6006 100 0
15360 .75 944932507 6006 100 0
20480 1 944932507 6006 100 0
 allocated pga
24576 1.2 944932507 0 100 0
28672 1.4 944932507 0 100 0
32768 1.6 944932507 0 100 0
36864 1.8 944932507 0 100 0
40960 2 944932507 0 100 0
 2x of current size
61440 3 944932507 0 100 0
81920 4 944932507 0 100 0
 4x of current size
122880 6 944932507 0 100 0
163840 8 944932507 0 100 0

14 rows selected.

In our example, values of more than 5120MB are useless, because there is no increase in the
ESTD_PGA_CACHE_HIT_PERCENTAGE field even if we increase the PGA size (we have already reached 100
percent, so using more memory won't get a further performance increase).

(F) Check SHARED POOL Advisory

col shared_pool_size_for_estimate format 999,999,999,999 head "Shared Pool Size (MB)"


col shared_pool_size_factor head "Size Factor"
col estd_lc_memory_object_hits format 999,999,999,999 head "Estimated Hits in Library Cache"
col estd_lc_size format 999,999,999,999 head "Estimate of LC Size"
col estd_lc_memory_objects format 999,999,999,999 head "Estimate of objects in LC"
select
shared_pool_size_for_estimate,
shared_pool_size_factor,
estd_lc_memory_object_hits,
estd_lc_size, estd_lc_memory_objects
from v$shared_pool_advice
order by shared_pool_size_factor
/

Shared Pool Size (MB) Size Factor Estimated Hits in Library Cache Estimate of LC
Size Estimate of objects in LC
--------------------- ----------- ------------------------------- -----------------
-- -------------------------
28,160 .898 69,864,719 1,8
22 99,988
30,080 .9592 81,836,886 3,7
41 179,461
30,208 .9633 81,985,740 3,8
69 185,248
30,336 .9673 82,126,659 3,9
97 189,291
30,464 .9714 82,261,653 4,1
25 192,902
30,592 .9755 82,392,730 4,2
53 197,185
30,720 .9796 82,520,736 4,3
81 199,909
30,848 .9837 82,655,962 4,5
09 202,193
30,976 .9878 82,796,661 4,6
37 204,447
31,104 .9918 82,927,747 4,7
65 206,867
31,232 .9959 83,053,927 4,8
93 209,801
31,360 1 83,888,119 5,0
21 213,067
31,488 1.0041 89,962,222 5,1
49 217,208
31,616 1.0082 90,073,373 5,2
77 221,543
31,744 1.0122 90,186,362 5,4
05 224,817
31,872 1.0163 90,295,508 5,5
33 228,517
32,000 1.0204 90,403,624 5,6
61 231,185
32,128 1.0245 90,507,787 5,7
89 234,425
32,256 1.0286 90,608,720 5,9
17 238,489
32,384 1.0327 90,708,166 6,0
45 243,556
32,512 1.0367 90,805,539 6,1
73 249,408
34,560 1.102 92,182,844 8,2
20 350,413
37,760 1.2041 93,605,210 11,4
19 433,775
40,960 1.3061 94,550,985 14,6
18 522,518
44,160 1.4082 95,268,724 17,8
18 639,147
47,360 1.5102 95,781,636 21,0
18 816,789
50,560 1.6122 96,098,928 24,2
18 920,414
53,760 1.7143 96,341,747 27,4
18 1,044,496
56,960 1.8163 96,574,858 30,6
18 1,142,128
60,160 1.9184 96,825,961 33,8
18 1,188,217
63,360 2.0204 97,072,213 37,0
18 1,257,187

31 rows selected.

http://www.oracle.com/technetwork/issue-archive/2012/12-nov/o62dba-1741123.html

Tuning – Sequential Reads


Abnormally high wait level may be an index that should not be used
 For table access
 For nested loop join
Check
 Statistics on the index are current
 Optimiser mode is not FIRST_ROWS
 Column has a histogram if data is skewed
 There is not an old SQL*Profile
 Bind peeking
If all this is OK – tune the SQL

Tuning – Scattered Reads


Abnormally high levels may be a full scan of large table
Check
 Statistics on the table and indexes are current
 System statistics are gathered
 Column has a histogram if data is skewed
 There is not an old SQL*Profile
 Bind peeking
If all this is OK – tune the SQL

Bind Peeking
 Values of bind variable inspected on hard parse
 Subsequent executions use the same plan
 If selective value first, subsequent executions may use innapropriate index
 If non selective value first, subsequent executions may full scan
 Set _optim_peek_user_binds to FALSE

Potrebbero piacerti anche