一、内存结构的概述:
Oracle用内存存储了以下信息:
(1) program code
(2) information about a connected session, even if it is not currently active
(3) information needed during program executjion (for example:the current state of a query from
which rows are being fetched)
(4) information that is shared and communicated among oracle processes (for example:locking
information)
(5) cached data that is also permanently stored on peripheral memory (for example:data blocks and
redo log entries)
二、内存结构的内容:
与Oracle有关的基本内存结构包括:
1.System Global Area (SGA), which is shared by all server and backgroud processes
2.Program Global Areas (PGA), which is private to each server and background process,there
is one PGA for each process
与SGA系统全局区域有关的内存模块:
(1)shared pool:used to allocate memory for sql and pl/sql execution.the shared pool portion
of the SGA contains the library cache, the dictionary cache,buffers for
parallel execution message and control structures. the total size of the
shared pool is determained by the initalization parameter shared_pool_size.
◆library cache:includes the shared sql areas,private sql areas(in the case of a shared
server configuration),pl/sql procedures and packages,and control structures
such as locks and library cache handles.
*shared sql area:stores each sql statment executed in the database.this area allows
sql execution plans to be reused by many users.
*private sql area:are non-shared memory areas assigned tounique user sessions.
*pl/sql area:used to hold parsed and compiled pl/sql program units,allowing the
execution plans to be shared by many users.
*control structures:common control structure information,for example,lock information
◆dictionary cache:stores environmental information,which includes referential
integrity,table definition,indexing information,and other metadata stored within
oracle's internal tables.
(2)large pool:an optional memory area that used to provide large memory allocations
◆session memory for the shared server and the oracle xa interface(used where
transactions interact tiwh more than one database)
◆i/o server processes
◆oracle backup and restore operations
(3)java pool:used in server memory for all session-specific java code and data within the jvm.
(4)streams pool:enables information sharing.you control what information is put into a
stream,how the stream flows or is routed from database to database.
(5)buffer cache:used for caching disk blocks
(6)redo buffer:used to buffer redo entries before they are written to a redo log file by
LGWR.redo entries keep a record of changes made to database blocks.
三、内存结构的管理:
1.自动管理的组件:
10G Oracle自动管理组件中通常包含:shared pool,java pool,large pool,buffer cache,streams
pool。管理员只需在数据库启动时指定sga_target的大小,数据库即可自动管理内部组件。这些组件默认参数都
是0,只有当该组件被使用时,相应的组件会自动从别的组件中获取内存而无需人工干涉。
2.手工管理的组件:
10G Oracle手工管理组件中通常包含:keep/recycle buffer caches(controled by db_keep_cache_size
and db_recycle_cache_size),additiolal buffer caches for non-standard block sizes(controlled by
db_nk_cache_size,n=[2,4,8,16,32]).这些组件的参数值是由管理员定义的,可以通过alter命令随时修改。
四、小结:
通过本小结的学习,我们了解了内存结构组件SGA,PGA,组件的组成部分,以及各组件的功能,通过对内存组件的学习,可以对将来性能优化提供很大帮助。
----thank you & best regards