ADP - Analyse, Design & Programmierung GmbH

Recording statistics with Oracle

Oracle records statistics which can be used to tune the instance in the following three dynamic views: v$sesstat, v$sysstat and v$mystat.
The following query can be used to retrieve all statistic data about the current session. If you're interested in other sessions as well, use v$sesstat.
column cls format a30
break on cls skip 1

select 
  decode (bitand(  1,class),  1,'User ',              '') ||
  decode (bitand(  2,class),  2,'Redo ',              '') ||
  decode (bitand(  4,class),  4,'Enqueue ',           '') ||
  decode (bitand(  8,class),  8,'Cache ',             '') ||
  decode (bitand( 16,class), 16,'Parallel Server ',   '') ||
  decode (bitand( 32,class), 32,'OS ',                '') ||
  decode (bitand( 64,class), 64,'SQL ',               '') ||
  decode (bitand(128,class),128,'Debug ',             '') cls,
  name,value from v m, v s where m.statistic# = s.statistic# order by 1
/

Automatically display statistics for sql statements

sql*plus allows to automatically display statistics for an sql statement entered by turning on autotrace.

Important statistics

bytes received via SQL*Net from client

bytes sent via SQL*Net to client

consistent gets

db block gets + consistent gets = logical io (as opposed to physical io).
consistent gets are current mode gets. This might entail a reconstruction of the block with the undo (rollback) mechanism.

db block gets

db block gets + consistent gets = logical io (as opposed to physical io).
db block gets are current mode gets, blocks that are read as they are (even if these are being modified by another session)

physical reads

physical reads = physical io (as opposed to logical io).

recursive calls

redo size

sorts (disk)

sorts (memory)

SQL*Net roundtrips to/from client

See how setting the arraysize affects SQL*Net roundtrips to/from client.

Hosted by www.Geocities.ws

1