Oracle memory structure (i) area information----SGA

Source: Internet
Author: User
Tags array arrays contains data structures header log sql variables
Oracle
Area information for SGA



The SGA (System global Area) global zone is combined with some of the necessary background processes called instances (Instance). said it is the global zone is comprised of global variables and data structures, and is the system area that contains the entire Oracle A instance data structure rather than a specific process structure.



SGA Area:

The SGA probably consists of four to five areas below:

The fixed area

The variable area

The database blocks area

The log buffer

The instance lock database (for parallel server instances)----Ops&rac

Depending on the size of the memory, we can set the fixed area and the log buffer to be very small.



The fixed area:

The fixed area of the SGA contains thousands of atomic variables, as well as small data structures such as latches and pointers (pointers) that point to other regions in the SGA. The names of these variables can be obtained by querying the table in the fixed table X$KSMFSV (as follows) , variable type, size, and address in memory.

Sql> Select Ksmfsnam, Ksmfstyp, Ksmfssiz, Ksmfsadr

2> from X$KSMFSV;

The names of these SGA variables are hidden and almost completely unnecessary to know. But we can get the values of these variables or check the data structures they point to by combining the table X$ksmmem in the fixed table.

Sql>select A.ksmmmval from X$ksmmem a where addr= (select addr from x$ksmfsv where ksmfsnam= ' Kcrfal_ ');

The size of each component of the fixed area in the SGA is fixed. That is, they are not dependent on the settings of other initialization parameters. The size of the components in the fixed area is the size of the fixed area.



The variable area:

The variable area in the SGA is composed of large pool and shared pool. The memory size of the large pool is dynamically allocated, while the memory size of the shared pool contains dynamically managed memory and contains a permanent (already allocated) Memory. In effect, the size setting of the initialization parameter shared_pool_size is an approximate sizes of the part of the memory that is dynamically allocated in the shared pool instead of the entire shared pool sizes

Persistent memory in Shared pool contains a variety of data structures such as: the buffer headers, processes, sessions, transaction arrays, the Enqueue resources, locks, th E online rollback segment arrays, various arrays for recording Statistics. Most of the size is determined by the setting of the initial parameter. These initial parameters can only be modified if the instance is closed. So the permanence here is for the lifetime of the instance's open state. A simple example of a processes parameter. In this process After the slots in arrays is used up, any other process that would like to request a process will fail because its size in memory is preconfigured when the instance is started. Cannot be modified dynamically.

For many permanent arrays, there are a lot of x$ tables that make a record of these elements and the member structure as a field. The v$ view data is obtained from these x$ tables. If V$process is based on X$KSUPR inner table. The v$process view does not contain all the fields of X$KSUPR. X$KSUPR also does not cover all members of the SGA process structure.

The sizes in the SGA in the variable area is equal to the SIZE of large_pool_size,shared_pool_size and permanent memory arrays. The total size of the permanent memory arrays can be computed by setting the initial parameter. However, you need to know the equation for these array sizes from the parameters, the number of bytes per array element size, There is also the sizes of the array header information. These are related to Oracle's version number and OS. In practice, we do not have to compute the size of this permanent memory arrays. If you want to know, one way to do this is to write down the Variable area. Then subtract the size of the large_pool_size and shared_pool_size in the argument.



The database block area:

This area is a copy of the database block. In Oracle 8i, the number of bytes is specified by db_block_buffers. The size of each buffer is specified by the db_block_size. So the size of this area is multiplied by the two. In Oracle 9i, The size of this area is db_cache_size specified. This zone does not contain its own control structure and contains only database block copies data. Header information for each buffer exists on the SGA's variable Area. And latches information is also placed in the variable area of the SGA. When you set Db_block_buffers, each 4 buffers affects the size of 1K in the variable area. About this. You can pass the test (for 8i).



The log buffer:

The size of this area is specified by the parameter log_buffer. If the OS supports memory protection, log buffer will be surrounded by two protection pages to prevent damage to log buffer by some Oracle error processes. In the SGA, with the others like variable Log buffer is very small compared to area and database block area. Log buffer is divided into internal buffer blocks, and each of these blocks has 8 bytes of header information that exists in the variable area.



The Instance lock database

In the Ops/rac configuration, instance locks is used to control the serial access and use of resources shared by all instances. This area of the SGA maintains the database resources that are used by the local instance, the database resources that all instances and processes use, and the locks (LOCKS) that all instances and processes currently require or already have. The size of these three arrays is determined by the parameter lm_ress,lm_ Procs,lm_locks parameter specified. (these three parameters are parameters of the RAC and are not viewable in a single instance with show parameter). The instance lock database also contains message buffers and other structure. But its size is very small.

The size of this area cannot be seen when the instance is started. This is Oracle internals. You can view it with the Oradebug tool. Sql>oradebug IPC. As for Oradebug tools, do not introduce. Use this tool to do operations with Oracle support consent.



You can dump the SGA in the following two ways:

Sql>alter session SET EVENTS ' immediate trace name Global_area Level 2 ';

or Sql>oradebug DUMP Global_area 2.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.