设为首页 收藏本站
查看: 709|回复: 0

[经验分享] oracle sga-pl

[复制链接]

尚未签到

发表于 2018-9-13 10:14:42 | 显示全部楼层 |阅读模式
  Oracle 11g的内存管理模式:AMM  Automatic Memory Management
  Oracle 10g的内存管理模式:ASMM Automatic Shared Memory Management
  ********************************************************************
  SGA:System Global Area(系统全局区)
  1.database buffer  cache
  2.redo log buffer
  3.shared pool
  4.java pool
  5.large pool
  6.stream pool
  7.fixed sga
  ***********************
  数据库启动,能够查看的sga的信息:
  SYS@orcl11g> startup;
  ORACLE instance started.
  Total System Global Area  422670336 bytes
  Fixed Size                  1345380 bytes
  Variable Size             318769308 bytes
  Database Buffers           96468992 bytes
  Redo Buffers                6086656 bytes
  Database mounted.
  Database opened.
  SYS@orcl11g>
  1.Database Buffer Cache
  数据库缓冲区
  The database buffer cache, also called the buffer cache, is the memory area that stores
  copies of data blocks read from data files。
  数据库缓冲区存储来自数据库文件的数据块的副本;
  buffer:数据库缓冲区中内存块的大小,和数据库数据文件的块的大小完全一致;
  数据库缓冲区存在的目的:
  优化物理 I/O
  能够缓存经常被访问的数据块,提高数据处理的效率
  Buffer States:
  unused: 未被使用的
  Clean: 干净的(说明buffer里面的数据信息和数据文件对应的数据块的存储内容是一致的);
  dirty: 脏块(说明buffer里面的数据信息和数据文件对应的数据块的存储内容不一致);
  每个buffer的访问模式:
  Every buffer has an access mode: pinned or free (unpinned)
  pinned:就是这个buffer正在被读或者写;
  free:空闲状态
  Buffer Modes:
  Current mode:当前模式。(update)
  A current mode get, also called a db block get, is a retrieval of a block as it currently appears in the buffer cache
  Consistent mode:一致性模式。(read)
  A consistent read get is a retrieval of a read-consistent version of a block. This
  retrieval may use undo data.
  buffer pool的分类:
  default:默认的buffer pool;如果没有做任何特殊配置,那么数据块默认被cacahe到default buffer pool;
  This pool is the location where blocks are normally cached。
  Keep pool:将一些频繁被访问的表,固定在数据库缓冲当中,不会因为缓冲区不足,而被置换出内存;
  Recycle pool:缓存某些不被经常访问的表,被cache,access之后,马上置换出内存;
  nK:非标准块的缓冲区大小;
  SYS@orcl11g> show parameter block_size
  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- -------
  db_block_size                        integer     8192
  目的:保证数据文件的数据块的大小要和buffer的大小保持一致;
  2.Redo Log Buffer
  重做日志文件缓冲区
  The redo log buffer is a circular buffer in the SGA that stores redo entries describing
  changes made to the database。
  redo log buffer是SGA当中的一个循环使用的buffer,存放描述数据块变化的redo entries;
  Redo entries contain the information necessary to
  reconstruct, or redo, changes made to the database by DML or DDL operations.
  redo entries:包含用于重建,重做dml或者ddl语句,所造成的数据库的变化的信息;
  redo log buffer的参数:
  SYS@orcl11g> show parameter log_buffer
  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- --------
  log_buffer                           integer     5890048
  3.Shared Pool
  共享池
  The shared pool caches various types of program data.
  For example, the shared pool  stores parsed SQL, PL/SQL code,
  system parameters, and data dictionary information.
  Library Cache:
  The library cache is a shared pool memory structure
  that stores executable SQL and PL/SQL code.
  库缓存,缓存了可执行的sql和pl/sql代码;
  数据库趋向于使用已经解析过,存放在库缓存中的sql 代码,如果能够重用这个库缓存中的sql code,
  这个行为称之为soft parse(软解析);反之,不能重用library cache中的sql code,那么,称之为
  hard parse(硬解析);
  解析:
  sql语句的执行过程,来描述解析的概念:
  1.查看sql的语法,语义部分;
  select employee_id,salary from hr.employees;
  2.会将这个sql做hash运算,变成一段hash代码
  3.会用这个hash值,去shared pool里面的library cache找,
  看看这个hash是否存在;
  如果存在,说明这条语句被执行过,直接重用这个执行代码就好了;
  如果不存在,需要解析这条语句:
  oracle server需要根据这条语句的具体相关信息,
  找出一个最优化的执行计划;
  Data Dictionary Cache:
  The data dictionary is a collection of database tables and views containing reference
  information about the database, its structures, and its users.
  This cache holds information about database objects. The cache is also known as
  the row cache because it holds data as rows instead of buffers.
  Server Result Cache:服务器结果缓存
  the server result cache holds result sets;
  Reserved Pool:shared pool的里面的保留pool
  The reserved pool is a memory area in the shared pool that Oracle Database
  can use to allocate large contiguous chunks of memory.
  4.Large Pool
  大池
  The large pool is an optional memory area intended for memory allocations
  that are larger than is appropriate for the shared pool
  应用场景:
  UGA
  并行执行的sql
  rman的slaves
  5.Java Pool
  The Java pool is an area of memory that stores all session-specific Java code
  and data within the Java Virtual Machine (JVM).
  6.Streams Pool
  流池
  The Streams pool stores buffered queue messages and provides memory for Oracle
  Streams capture processes and apply processes
  7.fixed sga
  The fixed SGA is an internal housekeeping area。
  General information about the state of the database and the instance,
  which the background processes need to access;
  Information communicated between processes, such as information about locks;
  ***************************************************************************************
  PGA: Program Global Area
  The PGA is a memory heap that contains session-dependent variables required by a
  dedicated or shared server process
  pga包含的内容:
  Private SQL Area:
  A private SQL area holds information about a parsed SQL statement and other
  session-specific information for processing
  SQL Work Areas:
  sql工作区
  Sort Area:order by会在这个区域进行
  Hash Area:多表连接的时候,hash连接做hash运算
  Bitmap Merge Area:位图合并区域
  UGA: User Global Area
  The UGA is session memory, which is memory allocated for session variables, such as
  logon information, and other information required by a database session;
  如果是dedicated server,那么,uga和pga在一起;
  如果是shared server,那么UGA,会在shared pool当中;
  而且如果配置了large pool,那么UGA,会在large pool当中;


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-577495-1-1.html 上篇帖子: oracle存储过程的简单学习2 下篇帖子: oracle pga-pl
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表