oracle 9i學習日誌(2)--內存結構

oracle內存結構包括兩個區域:SGA和PGA.
SGA(system global area):
1
SGA有叫共享全局區域(shared global area)。在instance啓動時被分配,用來存儲數據庫進程共享信息,包括數據和控制信息。主要組成包括:
       – Shared Pool
       – Database Buffer Cache
       – Redo Log Buffer
       – Other structures (for example, lock and latch management, statistical data)
還有兩個可選項: Large Pool, Java Pool。
下面語句可以查看SGA的分配情況:
SQL> SHOW SGA;
Total System Global Area 36437964 bytes
Fixed Size 6543794 bytes
Variable Size 19521536 bytes
Database Buffers 16777216 bytes
Redo Buffers 73728 bytes
從9i開始,可以在不關閉instance的情況下動態調整SGA的大小,這樣Database Buffer Cache, Shared Pool, 和Large Pool可以動態的調整而不需要關閉instance。
SGA的大小主要由以下幾個參數決定:
SGA_MAX_SIZE:規定了SGA的最大值。
DB_CACHE_SIZE:cache標準的塊大小,默認Unix 48M,NT 52M。
LOGG_BUFFER:redo log buffer的大小,單位Byte。
SHARED_POOL_SIZE, LARGE_POOL_SIZE, JAVA_POOL_SIZE。
SGA有一個分配粒度稱爲granule,默認大小爲 4 MB如果 SGA_MAX_SIZE< 128 MB,其他情況則爲 16 MB 。
The minimum SGA configuration is three granules (one granule for fixed SGA
[includes redo buffers]; one granule for Database Buffer Cache; one granule for Shared Pool).
 
各組件介紹:
shared pool
包括library cache和data dictionary cache,分別用於存儲最近執行過的編譯解釋後的SQL語句和最近用到的數據信息(數據字典)。
可以通過這條命令ALTER SYSTEM SET SHARED_POOL_SIZE = 64M;動態修改SHARED_POOL_SIZE的值。
Database Buffer Cache
最大的一塊內存,用於緩存從數據文件裏讀出的數據和被更新的數據,能有效地增強數據庫服務器的性能。
可以通過下面的命令動態改變它的大小:ALTER SYSTEM SET DB_CACHE_SIZE = 96M;
Buffer Cache Advisory功能,收集統計對於不同大小的Database Buffer Cache所表現出來的性能的信息,並在V$DB_CACHE_ADVICE這個視圖中列出。
The Buffer Cache Advisory is enabled via the DB_CACHE_ADVICE initialization
parameter. It is a dynamic parameter, and can be altered using ALTER SYSTEM. Three values (OFF, ON, READY) are available.
DB_CACHE_ADVICE Parameter Values
OFF: Advisory is turned off and the memory for the advisory is not allocated.
ON: Advisory is turned on and both cpu and memory overhead is incurred.
Attempting to set the parameter to the ON state when it is in the OFF state may lead to the following error: ORA-4031 Inability to allocate from the Shared Pool when the parameter is switched to ON. If the parameter is in a READY state it can be set to ON without error because the memory is already allocated.
READY: Advisory is turned off but the memory for the advisory remains allocated. Allocating the memory before the advisory is actually turned on will avoid the risk of ORA-4031. If the parameter is switched to this state from OFF, it is possible that an ORA-4031 will be raised.
Redo Log Buffer
記錄所有的數據庫數據塊的改變記錄,主要目的用於恢復。
每條記錄被稱爲重做條目,重做條目包含恢復信息或改變信息(information to econstruct or redo changes)。
Large Pool
可選項,緩解shared pool的負擔,用於
– Session memory (UGA) for the Shared Server
– I/O server processes
– Backup and restore operations or RMAN(Recovery Manager)
– Parallel execution(並行處理) message buffers
               PARALLEL_AUTOMATIC_TUNING set to TRUE
Java Pool
對Java的支持,如解釋執行Java編寫的存儲過程。
Program Global Area(PGA)
PGA是一塊內存區域,包含了單個server process或單個background process信息的數據和控制信息。當進程開始運行時PGA被分配,當進程結束時PGA被回收。與共享方式的SGA相對比,PGA是一個進程一塊內存。注意:oracle的server process和background process是嚴格區分的。
本文出自 “冰冷的太陽” 博客,請務必保留此出處http://luotaoyang.blog.51cto.com/545649/277173
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章