the SGA consists of serveral memory structures:
--shared pool(核心的) 共享池
--database buffer cache(核心的) 数据库缓冲区
--redo log buffer(核心的)
--other structures
there are two additional(额外的,附加的) memory structures that can be configured within the SGA:
--large pool(可选)
--java pool(可选)
SGA
is dynamic (动态)根据需要动态地增大缩小
sized by the SGA_MAX_SIZE parameter 可以设置最大大小
allocated and tracked(追踪) in granules(颗粒,SGA分配内存的基本单位) by SGA
(如果SGA小于128M granules的大小为4M 如果SGA得大小超过128M granules的大小为16M)
Components(SGA组件)
--contiguous(毗连,邻进的) virtual(虚拟) memory allocation连续分配的内存区域
--granule size based on total estimated(估计) SGA_MAX_SIZE根据颗粒大小估计总的SGA
select component,granule_size from v$sga_dynamic_components;
显示出SGA每个组成部分及每个组成部分他的granules的大小.
SGA 包含的多个组件 这些组件也有自己的尺寸
1.DB_CACHE_SIZE
2.LOG_BUFFER
3.SHARED_POOL_SIZE
4.LARGE_POOL_SIZE
5.JAVA_POOL_SIZE
shared pool
use to store(存放):
--Most recently executed SQL statements
在向数据库发出sql语句,数据库都会解析这个SQL语句,并生成执行计划,存放于共享池中
--Most recently user data definitions(定义)
it consists of two key performance-related(性能相关) memory structures
--library cache 高速缓存 (影响性能的重要部件)
--data dictionary cache
sized by the parameter "shared_pool_size"
修改共享池的尺寸 alter system set shared_pool_size=128M;
Library cache
Stores information about the most recently user SQL and PL/SQL statements
Enables the sharing of commonly(通常) used statements
is managed by a least(至少) recently user(LRU) algorithm(算法)
Consists of two structures:
--shared SQLarea
--shared PL/SQL area
size determined by the shared pool sizing
DATA Dictionary Cache
A collection of the most recently used definitions in the database
Includes information about database files,tables,indexes,columns,users,privileges,and other database objects
During the parse phase(阶段,时期),the server process looks at the data dictionary for information to resolve object name and validate(验证) access
Caching data dictionary information into memory improves(提高) response time on queries and DML
Size determined by shared Pool sizing
Database Buffer Cache
Stores copies of data blocks that have been retrieved(检索) from the data files
Enables great performance gains(收益) when you abtain and update data
Managed through an LRU algorithm
DB_BLOCK_SIZE determines primary block size
consists of independent subcaches:
--DB_CACHE_SIZE
--DB_KEEP_CACHE_SIZE
--DB_RECYCLE_CACHE_SIZE
can be dynamically resized(调整大小)
ALTER SYSTEM SET DB_CACHE-SIZE=96m;
DB_CHE_ADVICE set to gather(收集) statistics(统计) for predicting(预测) different cache size behavior
Statistics displayed by V$DB-CACHE_ADVICE
Redo Log Buffer
Records all changes made to the database data blocks
Primary purpose(目的) is recovery(恢复)
Changes recorded within are called redo entries(条目,输入)
Redo entries contain information to reconstruct(重建) or redo changes
Size defined by LOG_BUFFER
Large Pool
An optional area of memory in the SGA
Relieves(解除) the burden(负担) placed on the Shared Pool
Used for:
--Session memory (UGA) for the shared server
--I/O server processes
--Backup and restore(恢复) operations or RMAN
--Parallel(并行) execution message buffers
PARALLEL_AUTOMETIC_TUNING set to TRUE
Does not use LRU list
Size by LARGE_POOL_SIZE
Can be dynamically resized
JAVA Pool
Service parsing requirements(要求) for java commands
required(需要) if installing and using java
sized by JAVA_POOL_SIZE parameter
PGA (program global area)
每个后台进程对应一个PGA 后台进程启动就产生一个PGA 后台进程结束 PGA也就结束
Memory reserved(保留的) for each user process connecting to an oracle database
allocated(分配) when a process is created
deallocated(释放) when the process is terminated(终止)
used by only one process