1 / 20

Oracle Fundamental (Oracle 基礎 )

Oracle Fundamental (Oracle 基礎 ). 1. Introduction ( 簡介 ). 資料儲存單位動輒數百 GB 範例 : 旺宏 ERP – 每天兩個廠區資料約 2~3GB 範例 : 新竹貨運 – 每天約 90 萬筆交易 , 資料庫超過 TB 設計資料庫的原因 單次輸入 , 多次存取 Oracle 屬於關聯式資料庫. 基礎關鍵字. Started ( 啟動 ) Shutdown ( 關閉 ) Instance ( 實例 ) 一個執行的 oracle 10g 資料庫就是一個 instance 包含背景程序以及記憶體裡面的資料

ashtyn
Télécharger la présentation

Oracle Fundamental (Oracle 基礎 )

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 Fundamental(Oracle 基礎)

  2. 1. Introduction (簡介) • 資料儲存單位動輒數百GB • 範例:旺宏ERP –每天兩個廠區資料約2~3GB • 範例:新竹貨運 –每天約90萬筆交易,資料庫超過TB • 設計資料庫的原因 • 單次輸入,多次存取 • Oracle屬於關聯式資料庫

  3. 基礎關鍵字 • Started (啟動) • Shutdown (關閉) • Instance (實例) • 一個執行的oracle 10g資料庫就是一個instance • 包含背景程序以及記憶體裡面的資料 • Background process (背景處理程序) • 用來支援使用者存取已經啟動的oracle資料庫

  4. Oracle 系統架構 (DBA P.6-2)

  5. Logical Structures(邏輯化結構) • Database • 邏輯化與實體化結構的集合 • 用來儲存data與metadata • 為了讓資料庫能夠運作,oracle定義了數個邏輯上必須存在的結構表格 • Tablespace (表格空間) • Oracle 放置表格的地方 (P.1-6)

  6. System Tablespace • 系統自動產生 • 包含data dictionary (資料字典) • 紀錄所有表格,view • 包含系統操作必須的資料 • SYS 表格

  7. SYSAUX Tablespace • 系統自動產生 • 包含幫助system tablespace的其他必須資料 • HR 範例

  8. Temp Tablespace (預設暫時性表格空間) • SQL操作時,用來暫時儲存資料 • 通常用來完成排序及其他動作

  9. Undo Tablespace (回復表格空間) • 用來做資料還原 • 回復任何uncommitted(未確認)的transaction(交易) • 確保read consistency(讀取一致性) • Eg:10:00時執行一個命令,命令持續15分鐘, 就算有人10:05分時更改資料,要確保15分鐘內執行的資料都是10:00當時的資料 • 支援Flashback Query • 查閱歷史資料

  10. Physical Structures (實體結構) • 真正儲存資料的檔案 • Server parameter file (系統參數檔案) • 系統的初始化參數以及運作環境設定 • Control file (控制檔案) • 用來啟動以及操作資料庫 • 描述資料庫檔案名稱、位置以及大小 • Password file • 儲存加密過的使用者密碼 • 無法備份

  11. Flash Recovery Area • 獨立於資料庫外, 用來儲存備份的資料 • 資料庫的control file, spfile, datafile都有儲存 • On-Line Redo Log (線上重做日誌) • 可避免資料庫,作業系統損害 • 線上即時做Redo log • Archived Redo Log • 把已完成的inactive redo log備份 • 把control file 備份 • 可避免儲存媒體損壞 • 可線上回復

  12. On-Line Rego Log(線上重做日誌) • 紀錄資料庫中所有的資料更新 • 避免committed data遺失 • circular fashion • AB -- Begin of transaction #1 Create some new information Update some existing information Create some more new information Delete some information Save all the work that has been accomplished -- End of transaction #1 --Begin transaction #2 Update some information Back out the update by now saving the changed data --End transaction #2 Redo all to the committed data commit System fail

  13. 背景處理程序 • dbwr (database writer) • 將資料庫緩衝區寫入硬碟 • Lgwr (log writer) • 將資訊寫入線上重做日誌 • Ckpt (checkpoint) • 在檢查點更新檔案資訊 –觸發dbwr & lgwr • Smon (system monitor) • 確保資料consistency (一致性) • Pmon (process monitor) • 用來鬆綁資源 • Cjq0 (job queue coordination) • 產生工作程序佇列 • Arc0 (archiver) • 負責複製重做日誌

  14. Oracle 資料型別 • Varchar2 • 變動長度的字元 • Eg: varchar2 (30) • 自動調整儲存字元數,但是最多到30個字元 • Date • 時間與日期 • Timestamp • 和date很像,但不需to_char函數來處理想要顯示的資料 • Clob • 儲存字元資料,類似varchar2,但是可以大到4GB • Blob • 儲存大型二進位結構檔案

  15. Oracle 資料型別 • Number • Number (precision, scale) • Precision <=38, scale <=127 • Number (精確度,小數位) • Eg: number (3, 2) • 整數3-2=1位, 小數點2位 (其他的四捨五入) • Eg: number (9,4) • 整數9-4=5位,小數點4位 • Eg: number (30,0) • 30位的整數

  16. Oracle 資料型別 • date • 預設情況,會把日期用to_char函數轉換成字串型態來檢視 • timestamp • 和date差不多,差別在於顯示時不用to_char函數就可以把時間全部顯示出來 • clob • 超過4G的的字元資料 • blob • 二進位檔案,通常聲音、影像、圖片都是

  17. Table (表格) • Example Create table part_master( Id number (8) not null, Manufacturer_code number(4) not null, Inception date not null, Description varchar2(60) not null, Unit_price number(6,2) not null, In_stock varchar(1));

  18. View (視觀表) • Example Create view emp_hq As select * from employee_master Where loc_id=‘2’

  19. Trigger (觸發器) • 某些事件發生時,要觸發預設的動作 • 在資料更新(新增)時被觸發 • 必須依附表格存在 • Eg:新增一個新人時,觸發trigger salary 來把薪資*13.5放入年薪的欄位

  20. 其他 • Procedure (程序) • 一次執行多個動作 • 可以接受參數並和資料庫物件互動 • 比trigger功能強大 • Function (函數) • 和procedure相同,但有回傳值 • Package (程式套件) • 把function 跟 procedure結合在一起

More Related