Oracle table space, segment, area, block overview

Icon

  • Present in 表空间the
  • It is a collection
  • It is 数据块a collection
  • 数据块 Will be mapped to 磁盘块
    Insert picture description here

Draw the Oracle storage model in the form of an entity-relationship diagram, with the logical structure on the left and the physical structure on the right.
Insert picture description here

  • There is a relationship drawn with a dotted line, which represents a many-to-many relationship between segments and data files. The dashed line is used to indicate the relationship because the relationship should not exist. A good relationship engineer should not allow many-to-many relationships.

Tablespace

  • Tablespace tablespace is the highest structure in the storage structure.
  • When creating a table space, you need to specify the file to be stored. The table space can be cross-physical storage, but the next level object of the table space-the data segment cannot be specified to be stored in that file.
  • To allow data objects to access IO load balancing, you need to specify different data objects in different table spaces. This is why the data tables and indexes are built in different table spaces.
  • Table space creation:
Main tablespace description
SYSTEM System table space, used to store internal tables and data dictionary, etc.
SYSAUX System auxiliary table space, maintained by Oracle itself
UNDO Table space with revocation information
USERS Recommended table space for users
--查询系统表空间信息
SELECT * FROM dba_tablespaces;
SELECT * FROM user_tablespaces;

Data segment

  • Any type of database object is essentially a data segment. Data tables, indexes, rollbacks, and aggregation are all manifestations of data segments.
  • The data segment is created when the data object is created. As the volume of the object increases, multiple extents are continuously allocated for management.
--数据段类型
SELECT DISTINCT t.segment_type FROM dba_segments t;

--查询系统段信息
SELECT * FROM dba_segments;
SELECT * FROM user_segments;

--查询区、块信息
SELECT ds.owner,
       SUM(ds.bytes) / 1024 / 1024 "所占空间(单位: MB)",
       SUM(ds.blocks) 数据块,
       SUM(ds.extents) 分区
  FROM dba_segments ds
 WHERE ds.owner = 'SYS'
 GROUP BY ds.owner;

Area extent

  • Usually physical storage 随机reads and writes. Even in the same file, we cannot guarantee that the same piece of information is stored in absolutely continuous physical storage space.
  • Therefore, Oracle has the concept of partition extent: it represents a series of continuous data block collections.
SELECT * FROM dba_extents;
SELECT * FROM user_extents;

Data block

  • The data block is the smallest logical unit of Oracle data information.
  • The differences of different operating systems (Windows, Linux, Unix) are shielded, and all data operations are performed on Oracle blocks.
SQL> SHOW parameter db_block_size; -- 命令行 查询数据块大小

SQL> SHOW parameter db_file_multiblock_read_count; -- 一次从物理文件中读取数据块的数量

Guess you like

Origin blog.csdn.net/qq_34745941/article/details/100192287