1 / 35

Oracle 功能结构组件

Oracle 功能结构组件. 目标. 学完这个课程,你应该可以掌握你下内容: Oracle 体系结构的概念和它的主要组件 List the structures involved in connecting a user to an Oracle Instance. Password file. Overview of Primary Components. Instance. User process. SGA. Shared Pool. Database Buffer Cache. Redo Log Buffer. Library Cache.

gino
Download Presentation

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 功能结构组件

  2. 目标 • 学完这个课程,你应该可以掌握你下内容: • Oracle 体系结构的概念和它的主要组件 • List the structures involved in connecting a user to an Oracle Instance

  3. Password file Overview of Primary Components Instance Userprocess SGA Shared Pool DatabaseBuffer Cache Redo LogBuffer Library Cache Serverprocess Data DictionaryCache Large Pool Java Pool PGA PMON SMON DBWR LGWR CKPT Others Control files Datafiles Redo Log files Parameter file Archived Log files Database

  4. Oracle Server Oracle Server • An Oracle server: • Is a database management system that provides an open, comprehensive, integrated approach to information management • 由Oracle 数据库事例和Oracle数据库组成

  5. Oracle 事例 • 一个 Oracle 事例: • 意味着访问和存取一个Oracle database • 可以打开一个而且只有一个数据库 • 由内存和后台进程组成 Instance SGA Shared Pool Memory structures DatabaseBuffer Cache Redo LogBuffer Library Cache Data DictionaryCache Large Pool Java Pool Background process structures PMON SMON DBWR LGWR CKPT Others

  6. Oracle Server 建立连接和创建会话 • 连接到一个 Oracle 事例: • 建立一个用户连接 • 创建一个会话 Serverprocess 建立连接 创建会话 用户进程 Database user

  7. Oracle Database Redo Log files Control files Datafiles Parameter file Archived Log files Password file Oracle 数据库 • 一个 Oracle 数据库: • 是一个被看作是一个完整单元的数据集合 • 由三种文件类型组成

  8. 物理结构 • 物理结构包含三种文件类型: • 控制文件 • 数据文件 • 重做日志文件 Header Control files Datafiles (includes Data Dictionary) Online Redo Log files

  9. 内存结构 • Oracle的内存结构由两个内存区域构成 如下所示: • 系统全局区System Global Area (SGA): 在事例启动时分配, 而且是数据库事例最基本的组成部件 • 程序全局区Program Global Area (PGA): 在后台进程启动时分配

  10. 系统全局区SGA • SGA 由几个内存结构组成: • Shared Pool • Database Buffer Cache • Redo Log Buffer • Other structures (for example, lock and latch management, statistical data) • 还有两个额外的内存结构也可以配置在SGA中: • Large Pool • Java Pool

  11. System Global Area • SGA 是动态的 • 由 SGA_MAX_SIZE参数控制大小 • 通过SGA组件来分配和跟踪的粒度 • 连续的虚拟内存分配 • 分配粒度的大小取决于 SGA_MAX_SIZE总的大小

  12. 共享池Shared Pool • 用来存储: • 最经常被执行的 SQL 块和语句 • 最经常被使用的数据定义 • 它由两个重要的和性能有关的内存结构组成: • Library Cache • Data Dictionary Cache • Sized by the parameter SHARED_POOL_SIZE Shared Pool Library Cache DataDictionary Cache ALTER SYSTEM SET SHARED_POOL_SIZE = 64M;

  13. Library Cache • 存储的信息是一些最经常使用的 SQL and PL/SQL 块和语句 • Enables the sharing of commonly used statements • 被 least recently used (LRU) 算法来管理 • 由两个结构组成: • Shared SQL area • Shared PL/SQL area • 大小由 Shared Pool sizing来决定

  14. Data Dictionary Cache • 在数据库中最经常被用到的定义集合 • 包含的信息是有关 database files, tables, indexes, columns, users, privileges, 和其他数据库对象 • 在解析的整个阶段, 数据库server进程在数据字典里寻找信息来解决对象的名字和有效性访问 • 缓存数据字典的信息到内存中来提高对查询和DML语句的响应时间 • 大小由 Shared Pool sizing来决定

  15. Database Buffer Cache • 存储已经从数据库数据文件中复制的数据块的副本 • 当你获得和修改数据时,从而获得最大的性能 • 通过 LRU algorithm来管理 • DB_BLOCK_SIZE决定 primary block size Database BufferCache

  16. Database Buffer Cache • 由独立的 sub-caches组成: • DB_CACHE_SIZE • DB_KEEP_CACHE_SIZE • DB_RECYCLE_CACHE_SIZE • 能够被动态调整 • DB_CACHE_ADVICE为预测不同的cache size行为收集统计信息 • 字典表V$DB_CACHE_ADVICE显示统计状态 ALTER SYSTEM SET DB_CACHE_SIZE = 96M;

  17. Redo Log Buffer • 记录所有数据库中数据块的变化 • Primary purpose is recovery • Changes recorded within are called redo entries • Redo entries contain information to reconstruct or redo changes • 大小由 LOG_BUFFER来决定 Redo LogBuffer

  18. Large Pool • SGA 中一个可选的内存区域 • Relieves the burden placed on the Shared Pool • Used for: • Session memory (UGA) for the Shared Server • I/O server processes • Backup and restore operations or RMAN • Parallel execution message buffers • PARALLEL_AUTOMATIC_TUNING set to TRUE • 不使用 LRU 列表 • 大小由 LARGE_POOL_SIZE决定

  19. Java Pool • Services parsing requirements for Java commands • 如果安装并且使用java才使用 • 大小由 JAVA_POOL_SIZE参数决定

  20. Program Global Area • 为每一个用户连接到数据库预先分配的内存 • 在进程创建时分配 • 在进程终止时释放 • 进程独占方式使用 PGA Serverprocess Userprocess

  21. Process Structure • Oracle 利用各种类型的进程: • User process: Started at the time a database user requests connection to the Oracle server • Server process: Connects to the Oracle Instance and is started when a user establishes a session • Background processes: Started when an Oracle Instance is started

  22. User Process • 程序发出请求和Oracle server进行交互 • 必须第一次建立连接 • 不和 Oracle server直接交互 Serverprocess Userprocess Connectionestablished Database user

  23. Oracle server Server Process • 和 Oracle server 可以直接进行交互的程序 • 完成调用生成的和返回的结果数据 • 可以是专用也可以是共享Server Serverprocess Connection established Session created Userprocess Database user

  24. Background Processes • Maintains and enforces relationships between physical and memory structures • Mandatory background processes: • DBWn PMON CKPT • LGWR SMON • Optional background processes: • ARCn LMDn RECO • CJQ0 LMON Snnn • Dnnn Pnnn • LCKn QMNn

  25. Database Writer (DBWn) Instance SGA • DBWn writes when: • Checkpoint 发生 • 脏缓存达到极限 • 没有空闲的缓存 • Timeout 发生 • RAC ping request is made • Tablespace OFFLINE • Tablespace READ ONLY • Table DROP or TRUNCATE • Tablespace BEGIN BACKUP Database BufferCache DBWn Redo Log files Datafiles Control files Database

  26. Log Writer (LGWR) Instance SGA • LGWR writes: • At commit • When 1/3 full • When there is 1 MB of redo • Every three seconds • Before DBWn writes Redo Log Buffer DBWn LGWR Redo Log files Control files Datafiles Database

  27. System Monitor (SMON) Instance SGA • 负责: • Instance recovery • Rolls forward changes in redo logs • Opens database for user access • Rolls back uncommitted transactions • 合并 free space • 释放 temporary segments SMON Redo Log files Control files Datafiles Database

  28. Process Monitor (PMON) Instance SGA • 清理由于以下现象引起的失败进程: • Rolling back the transaction • Releasing locks • Releasing other resources • Restarting dead dispatchers PMON PGA area

  29. Redo Log files Control files Datafiles Database Checkpoint (CKPT) Instance SGA • Responsible for: • Signaling DBWn at checkpoints • Updating datafile headers with checkpoint information • Updating control files with checkpoint information DBWn LGWR CKPT

  30. Redo Log files Control files Datafiles Archiver (ARCn) • 可选的后台进程 • 当数据库为归档模式是,自动归档在线日志 • 保存数据库中所有变化的记录 ARCn Archived Redo Log files

  31. Logical Structure • 规定数据库中的物理空间怎样被使用 • 按层状划分为 tablespaces, segments, extents, and blocks Tablespace Datafile Segment Segment Extent Blocks

  32. 处理 SQL 状态 • Connect to an instance using: • User process • Server process • Oracle server 组件的使用依赖于SQL statement类型: • Queries return rows • DML statements log changes • Commit ensures transaction recovery • 一些 Oracle server 组件不参加 SQL statement 处理

  33. 总结 • In this lesson, you should have learned how to: • Explain database files: datafiles, control files, online redo logs • Explain SGA memory structures: Database Buffer Cache, Shared Pool, and Redo Log Buffer • Explain primary background processes: DBWn, LGWR, CKPT, PMON, SMON • Explain the use of the background process ARCn • Identify optional and conditional background processes • Explain logical hierarchy

  34. Practice 1 Overview • This practice covers the following topics: • Review of architectural components • Structures involved in connecting a user to an Oracle Instance

More Related