Data Block -- Uncompressed

时间:2022-03-14 09:02:49

Overview of Data Blocks
  Oracle Database manages the logical storage space in the data files of a database in units called data blocks, also called Oracle blocks or pages. A data block is the minimum unit of database I/O.

Data Blocks and Operating System Blocks
  At the physical level, database data is stored in disk files made up of operating system blocks. An operating system block is the minimum unit of data that the operating system can read or write. In contrast, an Oracle block is a logical storage structure whose size and structure are not known to the operating system.

数据块概览

  Oracle数据库管理数据文件的逻辑存储空间的单元叫数据块,也叫Oracle块或者页。一个数据块是数据库I/O的最小单元。

数据块和操作系统块的关系

  在物理层面,数据库的数据是存储在由操作系统块组成的磁盘文件中的。

  一个操作系统块是操作系统读写的最小数据单元。

  对应的,Oracle块则是逻辑存储结构,操作系统并不知道它的大小和结构。

  Figure 12–5 shows that operating system blocks may differ in size from data blocks. The database requests data in multiples of data blocks, not operating system blocks.

Data Block --  Uncompressed

  如图片所表示的,操作系统块的大小可能和数据块的不一样。一个数据库可能有对应多个操作系统块。数据库请求数据的对象是数据块,不是操作系统块。

  When the database requests a data block, the operating system translates this operation into a requests for data in permanent storage. 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
  Every database has a database block size. The DB_BLOCK_SIZE initialization parameter sets the data block size for a database when it is created. The size is set for the SYSTEM and SYSAUX tablespaces and is the default for all other tablespaces.

  The database block size cannot be changed except by re-creating the database.
  If DB_BLOCK_SIZE is not set, then the default data block size is operating system-specific. The standard data block size for a database is 4 KB or 8 KB. If the size differs for data blocks and operating system blocks, then the data block size must be a multiple of the operating system block size.

数据库块大小

  每一个数据库都有一个数据块的大小值。当数据库创建的时候该值由初始参数DB_BLOCK_SIZE决定。

  这个大小是SYSTEM和SYSAUX表空间的块大小值,也是其他表空间的默认值(其他表空间创建的时候可以指定块大小)

  数据库块的大小不能被改变除非重建数据库。

  假如参数DB_BLOCK_SIZE没有设置,那么默认的块大小由操作系统指定。标准的数据库块大小是4KB以及8KB。

  假如数据块的大小和操作系统块的大小不一样,那么数据块的大小一定是操作系统块大小的多倍。

Tablespace Block Size
  You can create individual tablespaces whose block size differs from the DB_BLOCK_SIZE setting. A nonstandard block size can be useful when moving a transportable tablespace to a different platform.

表空间块大小

  你可以创建一个块大小的值和参数设置的值不一样的表空间。当你迁移一个可迁移的表空间到一个不同的平台,非标准块大小是一个很有用的设置。

Data Block Format
  Every data block has a format or internal structure that enables the database to track the data and free space in the block. This format is similar whether the data block contains table, index, or table cluster data.

Figure 12–6 shows the format of an uncompressed data block -- 非压缩数据块格式

Figure 12–6 Data Block Format

Data Block --  Uncompressed

数据块的结构:

每一个数据块都有一个格式或者说内部结构来让数据库能够追踪到块的数据和空闲空间。不管这个块是包含表,索引还是聚簇表的数据,这个结构都是类似的。

Data Block Overhead
  Oracle Database uses the block overhead to manage the block itself. The block overhead is not available to store user data.

block overhead
  Space in a data block that stores metadata required for managing the block. The overhead includes the block header, table directory, and row directory.

数据块天花板

  Oracle数据库使用块天花板来管理块本身。块的天花板不可以用来存储用户数据。

  块的天花板是数据块里面存储用来管理数据块的元数据,它包括块头,表目录,行目录。

As shown in Figure 12–6, the block overhead includes the following parts:

■Block header
  This part contains general information about the block, including disk address and segment type. For blocks that are transaction-managed, the block header contains active and historical transaction information.
  A transaction entry is required for every transaction that updates the block. Oracle Database initially reserves space in the block header for transaction entries.

  In data blocks allocated to segments that support transactional changes, free space can also hold transaction entries when the header space is depleted.

  The space required for transaction entries is operating system dependent. However, transaction entries in most operating systems require approximately 23 bytes.

块头

  这个部分包含关于块的一般信息,比如磁盘地址,段类型。对于数据块的事务管理,数据块头部包含活动的和历史的事务信息。

  每一个事务在更新数据块的时候都要请求一个事务记录。Oracle数据库最初会在数据块头部为事务记录保留空间。

  在分配给支持事务变更的段的数据块上,当头部空间已经耗完的情况下,空间空间也可以用来保留事务记录。

  事务记录请求的空间是依赖于操作系统的。不过,事务记录在大多数操作系统上大约请求23byte 的空间。

■Table directory
  For a heap-organized table, this directory contains metadata about tables whose rows are stored in this block. Multiple tables can store rows in the same block.

表目录

  对于一个堆组织结构的表,这个目录包含关于表的元数据,即哪些行存储在这个块中。多个表可以在同一个块中存储行数据。

Note:堆组织表是指表里的数据没有按特殊顺序存储在磁盘中的表,默认下CREATE TABLE创建的就是堆组织表。

■Row directory
  For a heap-organized table, this directory describes the location of rows in the data portion of the block.
  After space has been allocated in the row directory, the database does not reclaim this space after row deletion.

  Thus, a block that is currently empty but formerly had up to 50 rows continues to have 100 bytes allocated for the row directory. The database reuses this space only when new rows are inserted in the block.

行目录

  对于一个堆组织表来说,这个目录描述的是指行在块中数据部分中的位置。在空间被分配到行目录后,数据库并不会在该行被删除后回收这一部分空间。

  因此,一个当前是空的数据块,但是之前曾经最多存储过50行数据的,将仍然有100bytes被分配到行目录中。只有当新的行插入到这个数据块的时候,数据库会重用这一部分空间。

Some parts of the block overhead are fixed in size, but the total size is variable. On average, the block overhead totals 84 to 107 bytes.

块天花板的一部分是固定大小的,但总的大小是可变的。平均来说,块天花板总共是84到107bytes。

Row Format
  The row data part of the block contains the actual data, such as table rows or index key entries.Just as every data block has an internal format, every row has a row format that enables the database to track the data in the row.
  Oracle Database stores rows as variable-length records. A row is contained in one or more row pieces. Each row piece has a row header and column data.

行格式

  数据块的行数据部分包含实际的数据,比如说表的行或者索引键的记录。因为每个数据块都有一个内部格式,每一行有一个行格式来让数据库追踪到行内的数据。

  Oracle数据库每一行可以存储不同长度的记录。一行可以包含在一个或多个行片段中,每一个行片段有一个行头部和列数据。

Figure 12–7 shows the format of a row.

Data Block --  Uncompressed

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
If an entire row can be inserted into a single data block, then Oracle Database stores the row as one row piece. However, if all of the row data cannot be inserted into a single block or an update causes an existing row to outgrow its block, then the database stores the row in multiple row pieces.A data block usually contains only one row piece per row.

行头部

  Oracle 数据库使用行头部来管理存储在块中的行片段。行头部包含以下信息:

行片段里面的列信息

存储在其他数据块中的行片段

如果行数据一整行都可以被插入到一个数据块里面,那么数据库就会把这一行数据存储在一个行片段里面。然而,假如没办法把一整行数据都插入到一个数据块,或者因为更新导致行数据超出了数据块,那么数据库会把这行数据存储在不同的行片段中。一个数据块一般只把一行数据存储在一个行片段中。

A row fully contained in one block has at least 3 bytes of row header.

完全存储在一个数据块中的一行记录至少有3bytes的行头部。

Column Data
  After the row header, the column data section stores the actual data in the row. The row piece usually stores columns in the order listed in the CREATE TABLE statement, but this order is not guaranteed. For example, columns of type LONG are created last.
  As shown in Figure 12–7, for each column in a row piece, Oracle Database stores the column length and data separately. The space required depends on the data type. If the data type of a column is variable length, then the space required to hold a value can grow and shrink with updates to the data.
  Each row has a slot in the row directory of the data block header. The slot points to the beginning of the row.

列数据

在行头部后面,列数据存储列的世纪数据。行片段通常会按创建表的时候的列名顺序来存储列,但这个顺序不是一定的,比如说,长类型的列会最后创建。

在12-7的图中,对于行片段中的每一列,Oracle会把列的长度跟数据分离。需要的空间大小由数据类型决定,如果一个类的数据类型是可变长度的,那么请求的空间会随着数据的更新增长或者缩减。

每一行在数据块头部的行目录都有一个插槽。这个插槽会指向行的开头。

Rowid Format

Oracle Database uses a rowid to uniquely identify a row. Internally, the rowid is a structure that holds information that the database needs to access a row. A rowid is not physically stored in the database, but is inferred from the file and block onwhich the data is stored.
An extended rowid includes a data object number. This rowid type uses a base 64 encoding of the physical address for each row. The encoding characters are  A-Z ,  a-z ,
0-9 ,  + , and  / .

Rowid格式

Oracle数据库使rowid来唯一指向对应的一行。rowid是数据库用来找到某一行数据的必要结构。rowid并不是物理存储在数据库中的,而是由数据存储的文件和块自动推断出的。

一个扩展的rowid包括一个数据对象数字。这个rowid类型使用一个64位编码的行物理地址。这个编码字符包含A-Z,a-z,0-9,+,/。

Example 12–1 queries the  ROWID pseudocolumn to show the extended rowid of the row in the  employees table for employee 100.

Example 12–1 ROWID Pseudocolumn
SQL> SELECT ROWID FROM employees WHERE employee_id = 100;
ROWID
------------------
AAAPecAAFAAAABSAAA

Figure 12–8 illustrates the format of an extended rowid.

Data Block --  Uncompressed

An extended rowid is displayed in a four-piece format,  OOOOOOFFFBBBBBBRRR , with the
format divided into the following components:
■ OOOOOO
The data object number identifies the segment (data object  AAAPec in
Example 12–1). A data object number is assigned to every database segment.
Schema objects in the same segment, such as a table cluster, have the same data
object number.

前六位是数据对象数字

■ FFF
The tablespace-relative data file number identifies the data file that contains the
row (file  AAF in Example 12–1).

7-9位数字是数据文件数字

■ BBBBBB
The data block number identifies the block that contains the row (block  AAAABS in
Example 12–1). Block numbers are relative to their data file, not their tablespace.
Thus, two rows with identical block numbers could reside in different data files of
the same tablespace.

10-15位是指数据块的数字,和数据文件相关联

■ RRR
The row number identifies the row in the block (row  AAA in Example 12–1).

最后三位数字指明在块中的行的数字

After a rowid is assigned to a row piece, the rowid can change in special circumstances.

For example, if row movement is enabled, then the rowid can change because of partition key updates, Flashback Table operations, shrink table operations, and so on. If row movement is disabled, then a rowid can change if the row is exported and imported using Oracle Database utilities.

在rowid被分配到某一个行片段后,在一些特殊环境rowid是可以改变的。

比如说,假如行迁移是启用的,那么rowid可以因为分区键的更新,闪回表操作,收缩表操作以及类似的操作而变化。如果行迁移是禁用的,那么当导入导出的时候,rowid是可以改变的。

--根据11g官方文档翻译,若有翻译不当或错误,请不吝指正,谢谢

Data Block -- Uncompressed的更多相关文章

  1. Data Block Compression

    The database can use table compression to eliminate duplicate values in a data block. This section d ...

  2. Populating Tabular Data Block Manually Using Cursor in Oracle Forms

    Suppose you want to populate a non-database data block with records manually in Oracle forms. This t ...

  3. ORA-01578 data block corrupted 数据文件损坏 与 修复 (多为借鉴 linux)

    好吧,先说说造成崩溃的原因: 使用redhat 5.9 Linux 作为数据库服务器, 周五数据库正在使用中,硬关机造成数据库文件部分损坏(周一上班时,应用程序启动不起来,查看日志文件时,发现一个数据 ...

  4. Hadoop EC 踩坑 :data block 缺失导致的 HDFS 传输速率下降

    环境:hadoop-3.0.2 + 11 机集群 + RS-6-3-1024K 的EC策略 状况:某天,往 HDFS 上日常 put 业务数据时,发现传输速率严重下降 分析: 检查集群发现,在之前的传 ...

  5. ORA-01578 ORACLE data block corrupted (file # 29, block # 2889087)

    BW数据库后台报错如下:F:\oracle\SBP\saptrace\diag\rdbms\sbp\sbp\trace ORA-01578: ORACLE data block corrupted ( ...

  6. 模拟ORA-26040: Data block was loaded using the NOLOGGING option

    我们知道通过设置nologging选项.能够加快oracle的某些操作的运行速度,这在运行某些维护任务时是非常实用的,可是该选项也非常危急,假设使用不当,就可能导致数据库发生ORA-26040错误. ...

  7. block(data block,directory block)、inode、块位图、inode位图和super block概念详解【转】

    本文转载自:https://blog.csdn.net/jhndiuowehu/article/details/50788287 一.基本概念:      1.block:文件系统中存储数据的最小单元 ...

  8. oracle --(一)数据块(data Block)

    基本关系:数据库---表空间---数据段---分区---数据块 数据块(data Block)一.数据块Block是Oracle存储数据信息的最小单位.这里说的是Oracle环境下的最小单位.Orac ...

  9. Copy Records From One Data Block To Another Data Block In Oracle Forms

    In this tutorial you will learn to copy the records from one data block to another data block on sam ...

随机推荐

  1. CentOS 6 部署GlusterFS

    首先需要关闭CentOS的防火墙和selinux,否则glusterfs将可能无法正常工作. /etc/init.d/iptables status 会得到一系列信息,说明防火墙开着. /etc/in ...

  2. CSS 分组

    选择器分组 假设希望 h2 元素和段落都有灰色.为达到这个目的,最容易的做法是使用以下声明: h2, p {color:gray;} 将 h2 和 p 选择器放在规则左边,然后用逗号分隔,就定义了一个 ...

  3. 【目录】C#操作Excel组件Spire.XLS系列文章目录

    本博客所有文章分类的总目录链接:http://www.cnblogs.com/asxinyu/p/4288836.html 1.C#操作Excel组件Spire.XLS文章目录 1.[原创].NET读 ...

  4. MySql中增加一列

    如果想在一个已经建好的表中添加一列,可以用诸如: alter table TABLE_NAME add column NEW_COLUMN_NAME varchar(20) not null; 这条语 ...

  5. 对#ifndef的理解

    由于对#ifndef的用法不太理解,在询问了老师#ifndef的含义以及查找资料后,对#ifndef总结了以下几点: <1> #ifndef是宏定义的一种,是三种预处理功能(宏定义,文件包 ...

  6. DriverStudio 和 WDF驱动 通过GUID获取设备句柄的差别

    DriverStudio /***************************************************************************** * 功能: 通过 ...

  7. webpack入门操作教程

    1. webpack介绍 在传统的项目中,一个html文件可能会加载多个js.css文件,如果多人协同开发的话,就会出现全局变量被污染.文件直接的依赖问题 而webpack打包工具,会先分析入口文件的 ...

  8. 初学c&num; -- 纯属无聊,写下棋

    纯属无聊了,会下的棋都做了. 象棋围棋修改用法都一样. 1.先启动服务端 goServer.exe服务端:地址为IPAddress[] addrIP = Dns.GetHostAddresses(&q ...

  9. MySQL管理工具HeidiSQL

    MySQL管理工具HeidiSQL   HeidiSQL 是一个功能非常强大的 MySQL 客户端软件.它是德国程序员Ansgar Becker和几个Delphi程序员开发的一个开源工具.要通过Hei ...

  10. IE7下对某些seajs压缩文件不兼容的解决方法

    seajs.config({ comboExcludes: /common.js/ }) (杨磊哥提供)