The following query can be used to determine the memory usage rates in Oracle databases. If there is an increase in the memory values from time to time, it will be necessary to examine the processes in the relevant time interval. From the dba_hist_snapshot view, memory usage rates can be determined by a query such as the following.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | SQL> set lines 1000 SQL> set pages 1000 SQL> SELECT sn.INSTANCE_NUMBER, sga.allo sga, pga.allo pga, (sga.allo + pga.allo) tot, TRUNC (SN.END_INTERVAL_TIME, 'mi') time FROM ( SELECT snap_id, INSTANCE_NUMBER, ROUND (SUM (bytes) / 1024 / 1024 / 1024, 3) allo FROM DBA_HIST_SGASTAT GROUP BY snap_id, INSTANCE_NUMBER) sga, ( SELECT snap_id, INSTANCE_NUMBER, ROUND (SUM (VALUE) / 1024 / 1024 / 1024, 3) allo FROM DBA_HIST_PGASTAT WHERE name = 'total PGA allocated' GROUP BY snap_id, INSTANCE_NUMBER) pga, dba_hist_snapshot sn WHERE sn.snap_id = sga.snap_id AND sn.INSTANCE_NUMBER = sga.INSTANCE_NUMBER AND sn.snap_id = pga.snap_id AND sn.INSTANCE_NUMBER = pga.INSTANCE_NUMBER ORDER BY sn.snap_id DESC, sn.INSTANCE_NUMBER; |
NOTE TO ANYONE READING THIS:
Great script, however an important item to note:
Provided you are licensed for the Diag+Tuning packs, this query is safe to run..
HOWEVER, if you are not licensed for those, you cannot even THINK of looking at the DBA_HIST_% views/tables because Oracle will tell you you’re in violation of the licensing agreement…
Great Script!