`
ammayjxf
  • 浏览: 68155 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

第二章 体系结构

 
阅读更多
第二章 体系结构[align=center][/align]
2.3The Memory Structures
SGA,System Global Area--This is a large, shared memory segment that virtually all Oracle processes will access at one point or another
PGA,Process Global Area--This is memory, which is private to a single process or thread, and is not acccessible from other processes/threads
UGA,User Global Area--This is memory associated with your session. It will be found either in the SGA or the PGA depending on whether you are running in MTS mode(then i'll be in the SGA), or dedicated sever(it'll be in the PGA)
2.3.1UGA and PGA
1.UGA实际上是会话的状态。它是会话必须始终得到的内存。UGA的位置总体上依赖于Oracle为了接受连接而实施的配置。如果已经配置了MTS,那么UGA必须在每个人都获得访问的内存结构中——这就是SGA。用这个方法,会话可以使用任何一个共享服务器,因为它们中的任何一个都可以读取或写入会话数据。另一个方面,如果正在使用专用服务器连接,对于会话状态的统一访问的需求就会消失,UGA本质上变得与PGA同义——它实际上包含在PGA当中。当研究系统的统计时,会发现UGA处于专用服务器模式下的PGA中。
2.PGA对一个进程是私有的。它是变量组,Oracle专用或共享服务器维持独立会话所需要的变量组。PGA是一个内存“堆”,在其中可能分配其他的结构。另一方面,UGA也是一个内存堆,在里面可以定义各种会话特定的结构。当使用专用服务器模式连接Oracle时,UGA从PGA中分配;在MTS模式下,从SGA中分配。
3.当使用MTS时,必须定义SGA的大小,以便在其中拥有足够的UGA空间,来满足同时连接到数据库的每一个可能的用户。所以,运行MTS数据库的SGA通常比类似配置的、只使用专用服务器模式数据库的SGA要大很多。
2.3.2SGA
1.Every Oracle instance has one big memory structure collectively referred to as the SGA, the System Global Area. This is a large, shared memory structure that every Oracle process will access at one point or another.
2. On a UNIX operating system, the SGA is a physical entity that you can 'see' from the operating system command line. It is physically implemented as a shared memory segment-a standalone piece of memory that processes may attach to.
3. On Windows, you really cannot see the SGA as you can in UNIX. Since Oracle executes as a single process with a single address space on the platform, the SGA is allocated as private memory to the ORACLE.EXE process.
4.The SGA is broken up into various pools. They are:
1)Java pool-The Java pool is a fixed amount of memory allocated for the JVM running in the database.
2)Large pool-The large pool is used by the MTS for session memory, by Parallel Execution for message buffers, and by RMAN Backup for disk I/O buffers.
3)Shared pool-The shared pool contains share cursors, stored procedures, state objects, dictionary caches, and many dozens of other bits of data.
4)The 'NULL' pool-This one doesn't really hava a name. It is  the memory dedicated to block buffers(cached database blocks), the redo log buffer and a 'fixed SGA' area.

1. Fixed SGA
1)Fixed SGA is compiled into the Oracle binary itself at installation time.
2)The fixed SGA contains a set of variables that point to the other components of the SGA, and variables that contains the values of various parameters.
2.Redo buffer
1)The redo buffer is where data that needs to be written to the online redo logs will be cached temporarily before it is written to disk. Since a memory-to-memory transfer is much faster then a memory to disk transfer, use fo the redo log buffer can speed up operation of the databse.
2)In fact, the contents of this area are flushed:
3.Block buffer cache
1)The block buffer cache is where Oracle will store database blocks before writing them to disk, and after reading them in from disk.
块缓冲区高速缓存是Oracle在将数据库块写入磁盘之前以及从磁盘读取数据库块之后,数据库块所存储的地方。
2)The blocks in the buffer cache are basically managed in two different lists. There is a 'dirty' list of blocks that need to be written by the database block writer. There is a list of 'not dirty' blocks. This used to be a LRU(Least Recently Used) list. Blocks were listed in order of use.
-Every three second
-whenever someone commits
-when it gets one third full or contains 1 MB of cached redo log data
3)块缓冲区高速缓存(Keep池,回收池,默认缓冲区池)
4)在Keep池中的块管理——如果频繁地使用一个块,它就被高速缓存。如果有一段时间不接触某个块,缓冲区池就用完空间,块就不再被池引用了。
5)在Keep池中,目标是只要可能,就保持使用频率中等和高的块的高速缓存。在回收池中,目标是如果一旦不再使用块,就使该块老化掉。
4.Shared pool
1)The shared pool is where Oracle caches many bits of 'program' data. When we parse a query, the results of that are cached here. Before we go through the job of parsing an entire query, Oracle searches here to see if the work has already been done.
2)Oracle stores the system parameters in the shared pool. The data dictionary cache, cached information about database objects, is stored here.
3)The easier way to break Oracle's shared pool is to not use bind variables. Not using bind variables can bring a system to its knees for two reasons:
-The system spends an exorbitant amount of CPU time parsing queries
-The system expends an extremely large amount of resources manageing the objects in the shared pool as a result of never reusing queries.
5.Large pool
1)The large pool is named because it is used for allocatiions of large pieces of memory, bigger than the shared pool is designed to handle.
2)The shared pool manages memory in a LRU basis, which is perfect for caching and reusing data. Large memory allocations, howerver, tended to get a chunk of memory, use it, and then were done with it - there was no need to cache this memory.
3)The large pool is a RECYCLE-style memory space wherears the shared pool is more like the KEEP buffer pool- if people appear to be using something frequently, then you keep it cached.
4)The large pooll is used specifically by:
-MTS - to allocate the UGA region in the SGA
-Parallel execution of statements - to allow for the allocation of inter-process message buffers, used to coordinate the parallel query servers
-Backup - fro RMAN disk I/O buffers
6.Java Pool
1)The Java pool is used in different ways, depending on the mode in which the Oracle server is running.
2)In dedicated server mode, the Java pool includes the shared part of each Java class, which is actually used per session. These are basically the read-only parts(execution vectous, methods, and so on) and are about 4 to 8KB per class.
3)In dedicated server mode, the total memory required for the Java pool is quite modest and can be determined based on the number of Java classes you will be using.
4)When executing in MTS mode, the Java pool includes:
- The  shared part of each Java class
- Some of the UGA used for per-session state of each session, which is allocated from the java_pool within the SGA
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics