The difference between oracle database table, segment, area and block

The logical structure of oracle includes tablespace (tablespace), segment (segment), area (extent), data block (data block).
Oracle database is logically composed of multiple tables. The objects stored in tablespace are called segments. Such as data segment, index segment, and rollback segment. A segment consists of extents, which are the smallest unit of disk allocation . The increase of the segment is realized by increasing the number of regions. The size of each area is an integer multiple of the size of the data block , and the size of the area can be different; the data block is the smallest I/O unit in the database, and is also the unit of the memory data buffer and the unit of data file storage space. The size of the block is set by the parameter DB_BLOCK_SIZE, and its value should be set to an integer multiple of the operating system block size.
Tablespace
Tablespace is the largest logical structure of the Oracle database . An Oracle database is logically composed of multiple tablespaces, and a tablespace belongs to only one database. There is a tablespace in Oracle called SYSTEM, this tablespace is created automatically when a database is created or installed. It is mainly used to store data dictionary , procedures, functions, triggers , etc. of the system; it can also store user tables, indexes, etc. A tablespace can have multiple datafiles, but a datafile can only belong to one tablespace.
A table space is a disk area, which consists of one or more disk files. A table space can hold many tables, indexes or clusters. Each table space has a pre-made disk area called the initial extent. After this extent is used up, the next one is used until the table space is used up. At this time, the table space needs to be expanded, adding data files or expanding the existing ones. The data file
segment segment
in Oracle can be divided into 4 types: data segment, index segment, rollback segment, temporary segment.
The data segment is used to store user data, and each table has a corresponding rollback segment whose name is the same as that of the data table . The index segment is used to store system and user index information. The rollback segment is used to store the value before the user data is modified. The rollback segment and the transaction have a one-to-many relationship. A transaction can only use one rollback segment, and a rollback segment can store the rollback of one or more transactions. data. Temporary segments are used for ordering by order by statements as well as some aggregations. An extent is the smallest unit
of
disk space allocation . Disks are divided into zones, and at least one zone is allocated at a time. Regions are stored in segments, which consist of contiguous blocks of data. During the allocation process of the area, 5 areas are allocated each time. If the remaining free space is not enough for 5 extents, an error occurs: ORA-01653. You can query the information about the extents in the tablespace through the dictionary dba_tablespaces. The information of the zone in the segment can be queried through the dictionary user_tables. The allocation status of the area can be queried through the dictionary user_extents. We can query the allocation information of tablespace, segment, and area in the area through the following SQL statements : SQL>select * from dba_tablespaces; SQL>select table_name, tablespace_name, min_extents, max_extents from user_tables;


SQL>select * from user_extents;
data block
data block is the smallest data organization unit and management unit in the data, the data file disk storage space unit, and the smallest unit of database I/O, the data block size is determined by the DB_BLOCK_SIZE parameter, different The default value of DB_BLOCK_SIZE is different for the oracle version.

Guess you like

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