Oracle Memory Structure (1) ---- SGA area information

xiaoxiao2021-03-06  71

SGA area information

The SGA (System Global Area) system is incorporated by incorporating some of the necessary background processes. Say that it is a global district that contains global variables and data structures, which contains data that contains access to Oracle Instance. Structure rather than a specific process structure.

SGA area:

SGA probably includes 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 a small.

The Fixed Area:

The Fixed Area in SGA includes thousands of atomic variables, as well as small data structures such as Pointers and Pointers (pointers) to other regions in SGA. You can get these by querying the Fixed Table Introduction x $ The name, variable type, size, and address in the memory.

SQL> SELECT KSMFSNAM, KSMFSTYP, KSMFSSIZ, KSMFSADR

2> From x $ kSMFSV;

The names of these SGA variables are hidden and don't know almost completely. But we can get the values ​​of these variables or check the data structures pointed to by combined with the Fixed Table in the table x $ kSmmem.

SQL> SELECT A.KSMMMMVAL 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 to say, they do not rely on the settings of other initialization parameters to adjust. The size of the components is added to Fixed Area. size.

The Variable Area:

The Variable Area in the SGA is made of Large Pool and Shared Pool. Large Pool's memory size is dynamically assigned, while the SHARED POOL memory size contains dynamic managed memory, which contains permanent (allocated) Memory. In fact, the size setting of the initialization parameter shared_pool_size is a probably sizes that specifies the partial memory allocated in Shared Pool instead of the entire shared pool SIZES.

Shared pool in the permanent memory contains various data structures such as: the buffer headers, processes, sessions, transaction arrays, the enqueue resources, locks, the online rollback segment arrays, various arrays for recording statistics most of which rely SIZE. The setting of the initial parameters is determined. These initial parameters can only be modified in a state where the instance is turned off. So the permanentity says this is for the survival of the instance. Simple example processes parameters. After Slots in this Process Arrays, if there is any other processs to apply for a process, it will fail because they are pre-allocated at the time of the instance startup. Can't dynamically modify.

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

The SIZES of the Variable Area is equal to the size of Large_Pool_Size, Shared_Pool_Size and the permanent memory arrays. The total size of the permanent memory arrays can be calculated by the setting of the initial parameters. However, you need Know the equation of these Array Sizes from the parameters, each Array element size, and the SIZES of Array header information. These are related to Oracle's version number and OS. In actual use, we don't have to calculate this permanent Memory Arrays size. If you want to know, a method is to write down the variable area when the Startup Nomount database is restored. Then subtract the size of LARGE_POOL_SIZE and Shared_Pool_Size in the parameter .The Database Block Area:

This area is a copy of the database block. In Oracle 8i, the buffer number is specified by db_block_buffers. The size of each buffer is specified by db_block_size. So the size of this area is multiplied by both. In Oracle 9i, the size of this area is db_cache_size Specify. This area does not include their own control structure, only contains Database Block Copies Data. Each buffer's header information exists in the Variable Area of ​​SGA. There is also Latches information in the SGA's THE VARIABLE AREA. In Settings DB_BLOCK_BUFFERS, every 4 buffers will affect the 1K size of 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, the log buffer will be surrounded by two protective pages to avoid log buffer in SGA. In SGA, with other Variable Area and Compared to Database Block Area, log buffer is very small. Log Buffer is divided into internal Buffer Blocks, and these blocks each have 8 bytes of head information exist in Variable Area.

The Instance Lock Database

In the OPS / RAC configuration, instance locks are used to control resources shared by all instances to enter and use. The area in SGA is maintained by the database resources you want to use by local instances, all instances and processes will Database resources, there are all instances and processes currently needed or have a lock (LOCKS). These three Arrays specified by parameters LM_RESS, LM_PROCS, LM_LOCKS parameters. (These three parameters are the parameters of RAC) In a single instance, it is not possible to view this in a single instance). The Instance Lock Database also contains Message Buffers and other structure. But its size is very small.

The size of this area is not seen when the instance is started. This is Oracle INTERNALS. You can use an ORADEBUG tool to view. SQL> ORADEBUG IPC. As for ORADEBUG tools, do not introduce. Use this tool to do Oracle Support agree.

You can use the following two ways DUMP SGA:

SQL> Alter Session Set Events 'Immediate Trace Name Global_Area Level 2'

Or SQL> ORADEBUG DUMP GLOBAL_AREA 2

转载请注明原文地址:https://www.9cbs.com/read-87800.html

New Post(0)