(Transfer) Explanation of data block BLOCK

Data block (DATA BLOCK) is the smallest logical component of Oracle . The smallest unit in which ORACLE stores data.

 

The logical data block space one level higher than Data blocks is extent, an extent is composed of a series of adjacent data blocks that store information.

 

A segment consists of a series of extents.

 

Tablespace (tablespace) is a logical entity containing physical data files and stores all available data of the database . Therefore, the size of the tablespace is also the sum of the size of the data files containing the data, which is the main logical storage structure of Oracle.


The size of the data block is an integer multiple of the data block of the operating system . ORACLE defaults to 8K, and there are also 4K, 16K, and 32K.

 

The parameter in the parameter file is DB_nK_BLOCK_SIZE, which can be managed by PCTFREE, PCTUSER, FREELIST.

 

An extent is a combination of several logically adjacent data blocks.


A segment is usually a segment, an INDEX, BLOB, and CLOB each occupy a segment. (BLOB uses binary to store data. CLOB uses CHAR to store data. )


Tablespace is where data is logically stored in the database. A tablespace can contain multiple data files. If the above three configurations conflict with the tablespace configuration, the tablespace shall prevail.

 

An Oracle block consists of three parts, namely the data block header, free space, and actual data. Data block header: It mainly contains some basic information about the address of the data block and the type of the segment, as well as the address of the table and the actual row containing the data. Free space: refers to the space that can be allocated for future update and insert operations. The size is affected by PCTFREE and PCTUSED parameters. Actual data: refers to the actual data stored in the row. When creating or changing any table and index, Oracle uses two storage parameters in space control: PCTFREE: The percentage of space reserved for future updates of existing data. PCTUSED: The percentage of minimum space for inserting a new row of data. This value determines the available status of the block. When the block is available, the inserted block can be executed, the block in the unavailable state can only be deleted and modified, and the block in the available state is placed in the freelist. When the data of a row in the table cannot be placed in a data block, two situations will occur at this time, one is row linking, and the other is row migration.


Row linking occurs when data is inserted for the first time if a block cannot hold a row. In this case, Oracle will use linking one or more blocks reserved in this segment to store this row of records. Row linking is more likely to occur on relatively large rows, such as rows with data types such as LONG, LONG RAW, LOB, etc. field, row linking is inevitable at this time. When a row of records is initially inserted, things can be stored in a block. The row length increases due to the update operation, and the free space of the block is completely full. At this time, row migration occurs. In this case, Oracle will migrate the entire row of data to a new block (assuming a block can store the entire row of data), and Oracle will retain the original pointer of the migrated row to point to the new block that stores the row data. This means that the ROW ID of the migrated row will not change. When row migration or row chaining occurs, the performance of data operations on this row will be degraded, because Oracle must scan more blocks to obtain information about this row.

Row linking is mainly due to the fact that the db_block_size of the database is not large enough, and some large fields cannot be stored in a block, resulting in row linking. For row linking, we have no other way to avoid it except increasing db_block_size, but because db_block_size is immutable after the database is established (before 9i), for Oracle9i database, we can specify different db_block_size for different tablespaces, So the generation of line links is almost inevitable, and there is not much that can be adjusted.

Row migration is mainly due to the fact that when the table is updated, the pctfree parameter setting of the table is too small, resulting in insufficient space in the block to accommodate the updated records, resulting in row migration. For row migration, it is very necessary to adjust, because this can be adjusted and controlled to clear.

 

Original address: http://blog.csdn.net/u011492628/article/details/19004481

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326254430&siteId=291194637