Concept
12.logical storage structures
主要就是说明逻辑存储结构之间的关系。逻辑结构是无法在操作系统中看到的
逻辑结构的介绍,数据块data blocks、区extents、段segments和表空间tablespaces的概览
Introduction to Logical Storage Structures
物理上,data存储在数据文件data files里,具体用操作系统块operating system blocks存储
逻辑和物理存储结构的关系如图:
one-to-many relationship
Logical Storage Hierarchy
Data blocks are the smallest units of storage that Oracle Database can use or allocate
Extent由连续的几个blocks组成
Segment由extent组成,对应数据库对象,比如表,索引等等data segment/index segment等
Each segment belongs to one and only one tablespace. Thus, all extents for a segment are stored in the same tablespace. Within a tablespace, a segment can include extents from multiple data files
Logical Space Management
·Locally managed tablespaces (default)
uses bitmaps in the tablespaces themselves to manage extents. Within a tablespace, the database can manage segments with automatic segment-space management (ASSM) or manual segment-space management (MSSM).
·Dictionary-managed tablespaces
Locally Managed Tablespaces
When an extent is allocated or freed, Oracle Database changes the bitmap values to show the new status of the blocks.
本地管理表空间的优势?
/*Automatic Segment-Space Management The ASSM method uses bitmaps to manage space.
Bitmaps provide the following advantages:
·Simplified administration
·Increased concurrency提高并发性
·Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment
Only one crucial SQL parameter controls space allocation: PCTFREE. */
/*Manual Segment-Space Management The legacy MSSM method uses a linked list called a free list to manage free space in the segment.
For a database object that has free space, a free list keeps track of blocks under the high water mark (HWM), which is the dividing line between segment space that is used and not yet used.
SQL parameters:PCTFREE,PCTUSED, FREELISTS, and FREELIST GROUPS*/
/*Dictionary-Managed Tablespaces Oracle Database updates tables in the data dictionary whenever an extent is allocated
or freed for reuse.*/
Overview of Data Blocks
also called logical blocks, Oracle blocks, or pages.
An Oracle data block is the minimum unit of database I/O.
Data Blocks and Operating System Blocks
Data blocks’size and structure are not known to the operating system.
The logical separation of data blocks from operating system blocks has the following implications:
·Applications do not need to determine the physical addresses of data on disk.
·Database data can be striped or mirrored on multiple physical disks.
Database Block Size
设置数据块大小的DB_BLOCK_SIZE initialization parameter在创建数据库时设置的。一旦设置就不能更改,除非重建数据库。DB_BLOCK_SIZE参数的作用是设置SYSTEM和SYSAUX表空间的数据块大小,并且作为其它表空间的数据块大小的默认值(can create individual tablespaces whose block size differs from the DB_BLOCK_SIZE setting.)
Data Block Format
Data Block Overhead
Oracle Database uses the block overhead to manage the block itself。not available to store user data.
·Block header:This part contains general information about the block, including disk address and
segment type.
·Table directory:contains metadata about tables whose rows are stored in this block.
Multiple tables can store rows in the same block.
·Row directory:describes the location of rows in the data portion of the block.
Row Format
The row data part of the block contains the actual data, such as table rows or index key entries.
A row is contained in one or more row pieces. Each row piece has a row header and column data.
Row Header Oracle Database uses the row header to manage the row piece stored in the
block.
The row header contains information such as the following:
·Columns in the row piece
·Pieces of the row located in other data blocks
·Cluster keys for table cluster data
Column Data the column data section stores the actual data in the row.
Rowid Format Oracle Database uses a rowid to uniquely identify a row.
OOOOOOFFFBBBBBBRRR,
Data Block Compression数据块压缩
Space Management in Data Blocks
Overview of Extents
extent是由一组contiguous连续的数据块(data block)构成的数据库逻辑存储分配单位。
If the initial extent become full, and if more space is required, then the database automatically allocates an incremental extent for this segment.可自动扩展
Deallocation of Extents
Can free extents的几种方法:
·You can use an online segment shrink to reclaim fragmented space in a segment.
·You can move the data of a nonpartitioned table or table partition into a new segment, and optionally into a different tablespace for which you have quota.
·You can rebuild or coalesce the index
·You can truncate a table or table cluster, which removes all rows.
·You can deallocate unused space, which frees the unused space at the high water mark end of the database segment and makes the space available for other segments in the tablespace
Storage Parameters for Extents
A locally managed tablespace can have either uniform. extent sizes or variable extent sizes determined automatically by the system:
·For uniform. extents, you can specify an extent size or use the default size of 1 MB. 统一的
All extents in the tablespace are of this size.
·For automatically allocated extents, Oracle Database determines the optimal size of additional extents, with a minimum extent size of 64 KB.可变的
英文真难懂。。。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24005010/viewspace-684118/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24005010/viewspace-684118/