Data files and log files are the most important files in the database. They are where the data is stored. Each database has at least one data file associated with it, and usually more than one, there are many. How is the data organized in the data file? To understand this, we first have to understand what table spaces (tablespace), segments (segment), zones (extent), blocks, are the basic units in which the Oracle database organizes data in a data file. Now let's understand these concepts.
Blocks are the physical units of data storage and are the most basic units in a data file, and data is stored directly on the block. is the smallest unit of Oracle space allocation. There are three common block sizes in Oracle, 2KB, 4KB, and 8KB. The size of the block is fixed when the database is created, the size of each block in the database is the same, and all the blocks are in the same format, consisting of the "size + Table Directory + row directory + Free Space + data space". The header contains information about the block type (for example, the block, or the index block), the location of the block on the disk, and so on. The table directory, if any, contains information about the tables in this block that store the rows (if data in more than one table exists in a block). Row directory contains a description of the data row, which is an array of pointers that indicate the physical location of each row in the data block. The size, table directory, and row directory are collectively called Block overhead, which is Oracle's original statistics and management block itself. The rest of the two parts are very simple, already have data is the data space, temporarily does not exist is the free space.
Area is called the disk area, is a continuous allocation space in the data file, it is larger than the block, composed of blocks. Some objects may require at least two extents when allocating space, such as a rollback segment, and the two extents do not necessarily require a connection. The size of the area varies from one block to 2GB
Segments are allocation units in an Oracle database, and objects such as tables, indexes, and so on are allocated in segments. When a table is created, a table segment is created, and an index segment is created when an index is created. Each object that consumes storage space is ultimately stored in a single segment. There are rollback segments, temporary segments, clustered segments, index segments, and so on.
A tablespace is a logical container that is associated with a data file, with at least one data file associated with a table space. A table space can have more than one segment and a segment can only belong to a single table space.
Schema, also known as pattern, is a logical concept that is smaller than the table space, and it is also a logical container. Multiple users may share a table space, how do you partition each user? There is a corresponding scenario for each user in the tablespace that holds the information for a single user.
The hierarchical structure stored in Oracle is summarized as follows:
A database consists of one or more table spaces
Table space consists of one or more data files, a table space contains multiple segments
The paragraph consists of one or more districts
The zone is a contiguous allocation space in the data file, consisting of one or more blocks
Five, block is the smallest and most basic unit in the database, is the smallest I/O unit used by the database
Six, each user has a corresponding scheme
1. Service name (actually: database name), a name that must be specified when you install ORACLE
2. tablespace table space, disk storage location for database objects
3. Schema scheme, logical classification of database objects
4. User users, equivalent to schema
5. Service Name > Tablespace > Schema (user)
Table spaces (tablespace), schema, segments (segment), extents (extent), blocks (block) in Oracle