It is important when sizing the SGA to consider how much memory you have on the machine and to know how much of that can be used for Oracle and how much is needed for the operating system. You do not want to allocate so much memory that the operating system is forced to page the SGA out to disk. Whenever I size the SGA for a database, I look at other, similar databases, to see what values they use. Oracle also provides some recommendations in the default initialization file that comes with the starter database. Once your database is running, you can
monitor cache hit ratio and monitor the key
shared pool statistics, to determine whether you have enough memory allocated.
There are at least two statistics related to the shared pool that you should monitor on a regular basis:
- the GETHIT ratio and
- the GETMISS ratio .
The gethit ratio tells you how often a SQL statement, or PL/SQL block, is found in the shared pool, already parsed, and with an execution plan that can be reused. This query returns the gethit ratio for several different object types:
SELECT namespace, gethitratio
FROM v$librarycache;
The closer the gethit ratio is to 1, the better. Values above 0.90 are generally accepted as indicators of good performance. A value of 0.90 means that only 10% of SQL statements need to be parsed, which means the shared pool is large enough to hold the 90% that are most frequently used. Another statistic to look at is the getmiss ratio. This applies to the data dictionary cache, and tells you how often Oracle has to go to disk for data dictionary information as opposed to finding that information already in memory, in the shared pool. The following query will give you the getmiss ratio:
SELECT SUM(getmisses)/SUM(gets) getmiss_ratio
FROM v$rowcache;
In this case, lower values are better. Oracle recommends keeping this number below 0.15.