Lesson 6 | Remedies for memory consumption |
Objective | Reduce memory usage. |
DB_BLOCK_BUFFERS
or DB_CACHE_SIZE
parameter. Monitor the buffer hit ratio to ensure it stays within acceptable limits (> 70% is usually recommended).SHARED_POOL_SIZE
.DBWR
, LGWR
, and ARCH
can consume significant memory. Tuning them by adjusting related parameters may help reduce memory usage.===================== BUFFER HIT RATIO ===================== (should be > 70, else increase db_block_buffers in init.ora) column "logical_reads" format 99,999,999,999 column "phys_reads" format 999,999,999 column "phy_writes" format 999,999,999 select a.value + b.value "logical reads", c.value "phys reads", d.value "phy writes", round(100 * ((a.value+b.value-c.value) / (a.value+b.value))) "BUFFER HIT RATIO" from v$sysstat a, v$sysstat b, v$sysstat c, v$sysstat d where a.statistic# = 37 and b.statistic# = 38 and c.statistic# = 39 and d.statistic# = 40; <Output> Hit Ratio Section *************************************************************** ===================== BUFFER HIT RATIO ===================== (should be > 70, else increase db_block_buffers in init.ora) logical_reads phys_reads phy_writes BUFFER HIT RATIO 94,228,594 511,535 734,784 99 Check the data buffer hit ratio. If it is above 95%, you can re-claim memory by reducing the db_block_buffers’ init.ora parameter.1) Check the data buffer hit ratio. If it is better than 95%, you can re-claim by reducing the db_block_buffers' init.ora parameter.
=========================== LIBRARY CACHE MISS RATIO =========================== (If > 1 then increase the shared_pool_size in init.ora) column "LIBRARY CACHE MISS RATIO" format 99.9999 column "executions" format 999,999,999 column "Cache misses while executing" format 999,999,999 select sum(pins) "executions", sum(reloads) "Cache misses while executing", ((sum(reloads)/sum(pins))) "LIBRARY CACHE MISS RATIO" from v$librarycache; <Output> =========================== LIBRARY CACHE MISS RATIO =========================== (If > 1 then increase the shared_pool_size in init.ora) executions Cache misses while executing LIBRARY CACHE MISS RATIO ------------ ----------------------------- ------------------------- 19,622,987 24,604 .0013
column value format 999,999,999 select name, value from v$sysstat where name like 'sort%'; spool off; << Output >> -------------------------------------------- NAME VALUE -------------------------------------------- sorts (memory) 87,101 sorts (disk) 280 sorts (rows) 109,142,433
SHOW PARAMETER db_block_buffers;
new_db_block_buffers = current_db_block_buffers - memory_to_reclaim/db_block_size;
SHUTDOWN IMMEDIATE;
db_block_buffers = new_db_block_buffers
STARTUP;