Oracle – Quick Check using Scripts

Not exhaustive


select * from v$sga_target_advice

select * from v$pga_target_advice

select * from v$shared_pool_advice


-- Dictionary Cache Hit Ratio
SELECT (1 - (Sum(getmisses)/(Sum(gets) + Sum(getmisses)))) * 100
  FROM   v$rowcache;

 -- -----------------------
  -- Library Cache Hit Ratio
  -- -----------------------
  SELECT (1 -(Sum(reloads)/(Sum(pins) + Sum(reloads)))) * 100
  FROM   v$librarycache;

 -- -------------------------------
  -- DB Block Buffer Cache Hit Ratio
  -- -------------------------------
  SELECT (1 - (phys.value / (db.value + cons.value))) * 100
  FROM   v$sysstat phys,
         v$sysstat db,
         v$sysstat cons
  WHERE  phys.name  = 'physical reads'
  AND    db.name    = 'db block gets'
  AND    cons.name  = 'consistent gets';

-- ---------------
  -- Latch Hit Ratio
  -- ---------------
  SELECT (1 - (Sum(misses) / Sum(gets))) * 100
  FROM   v$latch;

-- -----------------------
  -- Disk Sort Ratio
  -- -----------------------
  SELECT (disk.value/mem.value) * 100
  FROM   v$sysstat disk,
         v$sysstat mem
  WHERE  disk.name = 'sorts (disk)'
  AND    mem.name  = 'sorts (memory)';

-- Locks
SELECT a.serial# as serial,a.sid,a.username,b.type,b.ctime,lmode,a.osuser,c.sql_text
FROM v$session a,v$lock b, v$sqlarea c   WHERE b.type in ('TM','TX','UL') and   a.sid=b.sid and 
 lmode > 0 and  ((a.PREV_HASH_VALUE = c.hash_value and  a.prev_sql_addr = c.address and  a.sql_hash_value = 0) or  
(c.hash_value=a.sql_hash_value and c.address = a.sql_address))


Leave a Reply

Your email address will not be published. Required fields are marked *