DB BUFFER CACHE
db buffer cache由两部分组成:write list 和least recently used list(LRU)。其中,write list存储脏数据即那些已经被修改但是还没写入磁盘的数据。LRU包含三部分:free buffer、pinned buffer 和未移动到write list的dirty buffer。free buffer就是没有任何有用数据的buffer;pinned buffer为当前正在访问的buffer。
When an Oracle process accesses a buffer,the process moves the buffer to the most recently used (MRU) end of the LRUlist. As more buffers are continually moved to the MRU end of the LRU list,dirty buffers age toward the LRU end of the LRU list.
LRU可监视buffer cache的使用情况,buffer cache将根据其被引用的时间远近和引用的频率进行排序。因此,最经常使用且最近使用过的缓冲区将列在最近最常使用一端。传入的块先被复制到最近最少使用一端的缓冲区中,然后该缓冲区将被指定到列表中央,作为起点。从这个起点开始,缓冲区根据使用情况在列表中上下移动。
The first time an Oracle user processrequires a particular piece of data, it searches for the data in the databasebuffer cache. If the process finds the data already in the cache (a cache hit), it can readthe data directly from memory. If the process cannot find the data in the cache(acache miss), it must copy the data block from a datafile on disk into abuffer in the cache before accessing the data. Accessing data through acache hit is faster than data access through a cache miss.
检查点队列中列出将要写出到磁盘的缓冲区Oracle 数据库支持同一数据库中有多种块大小。标准块大小用于SYSTEM 表空间。标准块大小可以通过设置初始化参数DB_BLOCK_SIZE 来指定。其有效值介于2K 和32K 之间,默认值为8K。非标准块大小的缓冲区的高速缓存大小通过以下参数指定:
DB_2K_CACHE_SIZE
DB_4K_CACHE_SIZE
DB_8K_CACHE_SIZE
DB_16K_CACHE_SIZE
DB_32K_CACHE_SIZE
DB_nK_CACHE_SIZE 参数不能用于调整标准块大小的高速缓存的大小。如果
DB_BLOCK_SIZE 的值为nK,则设置DB_nK_CACHE_SIZE 是非法的。标准块大小的高速缓存的大小始终由DB_CACHE_SIZE 的值确定。
Some commonwisdom says that the larger the buffer cache is, the better the performance ofthe database becomes. However, this claim is not always true.
To begin with, the cache needs to be managed. Thebigger the cache, the larger theLRU and dirty list becomes. That results inlonger search times for a free buffer (buffer busy waits).
Also, thebigger the cache, the greater the burden on the DBWn process.
DB Cache 不是越大越好,如果DB Cache 过大,会造成大的LRU 列表和 dirty list。 这会会增加list的扫描时间。 同时大的cache 也会增加DBWn 进程的负担。
REDO LOG BUFFER
Theredo log buffer is a circular buffer in the SGA that holds information about changesmade to the database. This information is stored in redo entries. Redo entries contain the information necessary toreconstruct, or redo, changes made to the database by INSERT, UPDATE, DELETE,CREATE, ALTER, or DROP operations. Redo entries are used for databaserecovery, if necessary.
Oracle 服务器进程将重做条目从用户的内存空间复制到每个DML 或DDL 语句的重做日志缓冲区。重做条目包含重建或重做DML 和DDL 操作对数据库的更改所必需的信息。它们用于数据库恢复,需要占用缓冲区中的连续空间。
重做日志缓冲区是一个循环缓冲区;服务器进程可以用新条目覆盖重做日志缓冲区中已写入磁盘的条目。LGWR 进程的写速度通常都很快,足以确保缓冲区中始终有存储新条目的空间。LGWR 进程将重做日志缓冲区写入磁盘上的活动联机重做日志文件(或活动组成员)中。LGWR 进程将LGWR 上次写入磁盘以来进入缓冲区的所有重做条目复制到磁盘。
什么导致LGWR 执行写操作?
在以下情况下,LGWR 会从重做日志缓冲区中写出重做数据:
用户进程提交事务处理时
每隔三秒钟,或重做日志缓冲区三分之一的空间已填满,或包含至少1 MB 数据时
DBWn 进程将修改的缓冲区写入磁盘时(如果相应的重做日志数据尚未写入磁盘)
SHARE POOL
The shared pool portion of theSGA contains the library cache, the dictionary cache, buffers forparallel execution messages, and control structures.The total size of theshared pool is determined by the initialization parameterSHARED_POOL_SIZE. Thedefault value of this parameter is 8MB on 32-bit platforms and 64MB on 64-bitplatforms. Increasing the value of this parameter increases the amount ofmemory reserved for the shared pool.
library cache
库高速缓存包含共享SQL 区和PL/SQL 区- 经过完全语法分析或编译的PL/SQL 块和
SQL 语句的表示法。
PL/SQL 块包括:
过程和函数
程序包
触发器
匿名PL/SQL 块
dictionary cache
数据字典高速缓存将字典对象的定义存放在内存中。
user global area(UGA)
UGA包含Oracle 共享服务器的会话信息。使用共享服务器会话时,如果尚未配置大型池,则UGA 位于共享池中。
LARGEPOOL
large pool必须显式配置。大型池的内存不是来自共享池,而是直接来自SGA这就增大了Oracle 服务器在实例启动时需要的共享内存量。
large pool的优势
large pool用于为以下各项分配大量会话内存:
I/O 服务器进程
备份和还原操作
Oracle 共享服务器进程和Oracle XA 接口(事务处理与多个数据库交互时使用)
由于从large pool为Oracle 共享服务器分配会话内存,因此共享池中由于频繁分配和取消
分配大对象而产生的碎片也就很少。将大对象从共享池中分离出来,可增加共享池内存的使用效率,这意味着,它可以将更多内存用于处理新的请求,以及在需要时用于保留现有数据。
JavaPool
Javapool memory is used in server memory for all session-specific Java code anddata within the JVM. Java pool memory is used in different ways, depending onwhat mode the Oracle server is running in.
TheJava Pool Advisor statistics provide information about library cache memoryused for Java and predict how changes in the size of the Java pool can affectthe parse rate. The Java Pool Advisor is internally turned on whenstatistics_level is set to TYPICAL or higher. These statistics reset when theadvisor is turned off.
StreamsPool
In a single database, you can specify that Streamsmemory be allocated from a pool in the SGA called the Streams pool. Toconfigure the Streams pool, specify the size of the pool in bytes using theSTREAMS_POOL_SIZE initialization parameter.
Ifa Streams pool is not defined, then one is created automatically when Streamsis first used. If SGA_TARGET is set, then the SGA memory for the Streams poolcomes from the global pool of SGA. If SGA_TARGET is not set, then SGA for theStreams pool is transferred from the buffer cache. This transfer takes placeonly after the first use of Streams. The amount transferred is 10% of theshared pool size.
本文出自 “mayjcle” 博客,谢绝转载!