Oracle Server = Instance + Database
- Instance = SGA (共享記憶體) + Background Processes (背景程序)
- Database = 實體檔案 (Datafiles, Controlfiles, Redo Logs, Parameter Files, Password File)
記憶體結構
SGA = Database Buffer Cache + Redo Log Buffer + Shared Pool + Large Pool + Java Pool + Streams Pool
PGA = Sort Area + Hash Area + Session Info + Stack (每 Process 私有)
SGA 核心元件功能
| 元件 | 功能 | 關鍵參數 |
| Database Buffer Cache | 快取資料塊映像,減少實體 I/O | DB_CACHE_SIZE |
| Redo Log Buffer | 循序記錄變更向量,LGWR 寫入線上 Redo Log | LOG_BUFFER |
| Shared Pool | Library Cache (Shared SQL/PLSQL) + Data Dictionary Cache | SHARED_POOL_SIZE |
| Large Pool | 大型作業緩衝 (平行查詢、RMAN、MTS UGA) | LARGE_POOL_SIZE |
| Java Pool | Java 程式碼/資料緩衝 | JAVA_POOL_SIZE |
| Streams Pool | Streams 複寫/擷取/應用 | STREAMS_POOL_SIZE |
背景程序 (必備)
| 程序 | 職責 |
| DBWn | 將髒塊從 Buffer Cache 寫入資料檔 |
| LGWR | 將 Redo Log Buffer 寫入線上 Redo Log 檔 |
| CKPT | 更新資料檔/控制檔檢查點資訊,觸發 DBWn |
| SMON | Instance Recovery、臨時段清理、空間合併 |
| PMON | 清理失敗 Process 遺留資源 (鎖、Session、Rollback) |
可選背景程序
- ARCn:歸檔程序 (歸檔模式必備)
- RECO:分散式交易恢復
- Snnn / Pnnn:Shared Server / Dispatcher
Process 架構差異
- Unix/Linux:每個背景程序對應一個 OS Process (專用伺服器模式)。
- Windows:單一
ORACLE.EXE Process,背景程序以 Thread 形式運行。
連線流程
User Process → Listener → Server Process (Dedicated/Shared) → SGA/Background Processes ↔ Database Files
Server Process 負責與 User Process 交換資料、解析執行 SQL、管理 PGA。
- 上一篇文章: Oracle 記憶體架構與 SGA/PGA 參數調優完整指南 (含 10g ASMM、11g AMM)
- 下一篇文章: Oracle SGA 與 PGA 大小修改實戰:參數設定、SPFILE 生效與重啟驗證
Copyright ©
程式碼之家 All Rights Reserved