oracle內存結構(二)

DB BUFFER CACHE

db buffer cache由兩部分組成:write list least recently used listLRU)。其中,write list存儲髒數據即那些已經被修改但是還沒寫入磁盤的數據。LRU包含三部分:free bufferpinned buffer 和未移動到write listdirty bufferfree buffer就是沒有任何有用數據的bufferpinned 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 proce***equires 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.

       


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章