1 / 30

Oracle – memory and process structure

Oracle – memory and process structure. 9134040 董庭吉 . 2005/12/08. outline. Oracle 系統架構 memory process. architecture. memory. process. file. architecture. memory. process. file. 運作方式.

mason
Télécharger la présentation

Oracle – memory and process structure

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Oracle – memory and process structure 9134040 董庭吉  2005/12/08

  2. outline • Oracle 系統架構 • memory • process

  3. architecture memory process file

  4. architecture memory process file

  5. 運作方式 • Oracle 以 Instance 的運作觀念,每一個資料庫都有自己獨立的 Instance,每一個 Instance 則有自己可用的記憶體、自己記憶體的運用方式、Process 處理方式。 • Oracle 可以針對每一個資料庫依需求進行運作方式與資源配置的調整。 A database B database C database A instance B instance C instance Client A、B、C Client D、E、F Client G、H、I

  6. Oracle instance • 當資料庫管理師啟動一個資料庫時,系統就會根據參數檔的內容配置一個記憶區塊( SGA, System Global Area )給該資料庫,此一區塊用來存放供 Server 端及 Client 端存取的資料庫共享資訊,在此同時,系統的 Background process 也會啟動,這兩者統稱 Oracle instance。 Oracle instance

  7. outline • Oracle 系統架構 • memory • process

  8. memory • 每當Oracle系統啟動時,會佔用主機一大塊資料庫專屬的記憶体空間來控制資訊與儲存資料,這塊資料庫專屬的記憶体空間稱為System Global Area (SGA)。 • 為了維持系統的執行效率,這塊記憶體必須是non-paged and non-swapped。

  9. Shared pool • 由”shared SQL areas” and “data dictionary cache”所組成 • shared SQL areas:主要目的是保存最近使用的SQL指令,例如:SQL指令、被Compile過的SQL parse tree等等。 • Data dictionary cache:server在執行過程中要不斷查詢資料字典,為了提高效能,系統會將相關資料放入此區。 • Table,view的名稱 • 欄位名稱和資料型態 • 使用權限

  10. Data buffer cache • 用來存放最近由資料庫讀出的資料。因為SQL指令常有重覆性,當相同的資料被存取時,只要Cache中的資料還在,則Oracle可利用讀取Database Buffer Cache中的資料的方式,以減少I/O而達成提高效率。

  11. Redo log buffer • 為了加快線上交易的效率,異動交易的記錄的內容並不直接寫入磁碟檔案中,而是存放在Redo Log Buffer這記憶体空間中。Oracle系統是以循環使用的方法將異動交易的記錄寫入Redo Log Buffer中,做為日後Oracle系統回復資料之用。

  12. Large pool • Server與server之間資料共享operation的暫存區。 • 作sorting所需的暫存區。

  13. outline • Oracle 系統架構 • memory • process

  14. process process Background process foreground process Server Process user Process

  15. userprocess process Background process foreground process server Process user Process • 當使用者的應用程式欲以SQL指令存取資料庫資料時,例如:Oracle Tools、SQLplus、Oracle Form等等,Oracle 會產生User Process去執行這些用戶的應用程式。

  16. userprocess process Background process foreground process server Process user Process • Server Process則直接面對使用者,負責處理來自User Process的請求(request)。 • Oracle系統對於每一個User Process會啟動一個Server Process與之對應,Server Process負責處理其對應的User Process的SQL指令,並將結果傳回給User Process。

  17. 運作關係 • 流程如下: • (1)server process解析並執行user process傳來的SQL指令 • (2) server process再從Datafile中讀取必要的Data block,傳到SGA的data buffer cache

  18. Background process • Background Process為一些維繫資料正常運作所需的Server程式,這些Process直接影響Oracle系統的執行的穩定性與效率,並伴隨系統啟動時開始於背景執行,直到資料庫關閉(Shutdown)為止。

  19. DBWR (database writer) • 在oracle中,為了加強執行的效率,伺服器只處理data buffer cache裡的資料。 • DBWR的工作就是用來維持記憶体與磁碟中資料的一致性,它負責不定時將記憶体中已修改的資料(Dirty Buffer)寫入磁碟中的Data file中。

  20. LGWR (log writer) • 伺服器會將user所執行的transaction記錄在redo log files中。 • 同樣的,為了執行效率,一樣使用cache的機制。 • 每當交易動作執行完畢後,系統便會建立一個Redo Entries,記錄該交易所做的變更資訊。 • 只要該交易經過Commit後,LGWR就會將該交易所對應的Redo Entries從Redo Log Buffer中寫到資料庫的交易記錄檔去。

  21. PMON (process moniter) • 負責回收已中斷的程式其所佔用的系統資源。 • 回復尚未執行的交易。 • 清除不正常中斷的連線。 • 主要為清除程式的占有的資源。

  22. SMON (system moniter) • SMON監控所有的系統資料的正確性,當資料庫開啟時檢查資料的一致性,一旦發現了資料有不一致性時會進行Crash Recovery資料回復動作。 • 當資料庫存取動作少時,將資料檔中可用的片段空間合併成一塊連續性較大的空間。 • 主要為監控系統資料的正確性及回收不當資料所占有的空間。

  23. CKPT (checkpoint) • 一個DBWR行程會定期呼叫CKPT,只要CKPT一啟動,DBWR就會將所有修改過的資料區塊從記憶體中寫入資料裡。 • CKPT的目的是要強迫DBWR將資料寫到資料庫裡面,以維持資料的一致性,只要CKPT一執行,所有經過Commit的資料變更都會被寫到資料庫中的資料檔裡。 • 經由管理者設定

  24. ARCH ( archiver) • ARCH會在交易記錄檔被LGWR寫滿了之後,將交易記錄檔備份起來。 • 所有由ARCH行程所產生的備份交易紀錄檔統稱為離線復原記錄(Offline Redo Log)。 • 萬一資料庫遭遇嚴重毀損時,Oracle系統會利用備份資料庫和備份交易記錄檔來將資料庫修復。

  25. RECO (recover) • 選項功能,所以不在右圖上。 • 處理分散式系統的分散式交易下的資料回復。 • 使得各地的資料庫保持一致性。

  26. 設定SGA及process 的memery大小

More Related