Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

SYSTEM GLOBAL AREA (SGA)

SGA is a shared storage area in memory that is the center of Oracle activity while the
database is running. The size of the SGA (and performance of the system) depends on the
values of the variable initialization parameters. The SGA provides communication
between the user and the background processes.

When you start a database, Oracle allocates a memory area (the System
Global Area, or SGA)

shared by all of the database users. The two largest


areas of the SGA are the database buffer

cache and the Shared Pool; their size will directly


impact the memory requirements for the

database and the performance of database operations.


Their sizes are controlled by parameters

in the database’s initialization file.

The database buffer cache is an area in the SGA used


to hold the data blocks that are read

from the data segments in the database, such as tables,


indexes, and clusters. The size of the

database buffer cache is determined by the DB_CACHE_SIZE


parameter (expressed in terms of

number of bytes) in the initialization parameter file for


the database. The default size for the
database blocks is set via the DB_BLOCK_SIZE parameter specified in the
parameter file

during database creation. Managing the size of the


database buffer cache is an important part

of managing and tuning the database.

The database has a default block size, but you can


establish cache areas for different database

block sizes and then create tablespaces to use those


caches. For example, you can create a 4K

database block size database with some tablespaces set to


8K. The size of the 8K cache would be

set via the DB_8K_CACHE_SIZE parameter. To create


tablespaces to use that cache, specify

blocksize 8K as part of the create tablespace command. If


the default block size for the database
is 4K, you would not set a value for DB_4K_CACHE_SIZE;
the size specified for DB_CACHE_SIZE

would be used for the 4K cache.

The different cache areas can be resized while the


database is running. The caches must be

increased or decreased in granules. For a database with


an SGA less than 128M, the granule size

is 4M—so DB_8K_CACHE_SIZE can be 4M, 8M, 12M, and so on.


If you attempt to use any other

setting, Oracle will round it up to the next granule


size. The following listing shows the setting of

the DB_8K_CACHE_SIZE parameter.

alter system set DB_8K_CACHE_SIZE = 8m;

If you create a tablespace that uses a non-default


database block size, you must be sure that

the related cache size parameter (such as


DB_8K_CACHE_SIZE) is updated in your database

parameter file. If you are using an init.ora file, you


must update it with the new value. If you are

using a system parameter file, it will be automatically


updated when you execute the alter system

command.

NOTE

You cannot alter the SGA_MAX_SIZE or JAVA_POOL_SIZE


parameter

values while the database is open.

Typically, the data block buffer cache is about 1 to


2 percent of the allocated size of the

database. Oracle will manage the space available by using


an algorithm that keeps the most
actively used blocks in memory for as long as possible.
When free space is needed in the cache,

the new data blocks will either use the space occupied by
infrequently accessed blocks or the

space occupied by a modified block once it has been


written out to disk.

If the SGA is not large enough to hold the most


frequently used data, different objects will

contend for space within the data block buffer cache.


This is particularly likely when multiple

applications use the same database and thus share the


same SGA. In that case, the most recently

used tables and indexes from each application constantly


contend for space in the SGA with the

most recently used objects from other applications. As a


result, requests for data from the data

block buffer cache will result in a lower ratio of “hits”


to “misses.” Data block buffer cache

misses result in physical I/Os for data reads, resulting


in performance degradation.

The Shared Pool stores the data dictionary cache


(information about the database structures)

and the library cache (information about statements that


are run against the database). While the

data block buffer and dictionary cache enable sharing of


structural and data information among

users in the database, the library cache allows the


sharing of commonly used SQL statements.

The Shared Pool contains the execution plan and


parse tree for SQL statements run against

the database. The second time that an identical SQL


statement is run (by any user), Oracle is able

You might also like