Oracle 数据块 Block 说明
在官网看到了这段信息,讲的很细。 贴过来。
Logical Storage Structures
http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/logical.htm#CNCPT7668
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
(1)Applications do not need to determine the physical addresses of data on disk.
(2)Database data can be striped or mirrored on multiple physical disks.
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 shows the format of an uncompressed data block.
5.1 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.
5.2 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.
-- metadata,元数据,指表的定义语句。
heap-organized table: A table in which the data rows are stored in no particular order on disk. By default, CREATE TABLE creates a heap-organized table.
5.3 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.
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.
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.
Figure shows the format of a row.
(2)Pieces of the row located in other data blocks
(3)Cluster keys for table clusters (see "Overview of Table Clusters")
A row fully contained in one block has at least 3 bytes of row header.
See Also: "Table Storage" and "Index Storage"
Example 12-1 ROWID Pseudocolumn
SQL> SELECT ROWID FROM employees WHERE employee_id = 100;
the following Figure illustrates the format of an extended rowid.
-- 数据对象编号:每个数据对象(如表或索引)在创建时都分配有此编号,并且此编号在数据库中是唯一的.
The row number identifies the row in the block (row AAA in Example 12-1).
If row movement is disabled, then a rowid can change if the row is exported and imported using Oracle Database utilities.
Note:
Internally, the database performs row movement as if the row were physically deleted and reinserted. However, row movement is considered an update, which has implications for triggers.
The database can use table compression to eliminate duplicate values in a data block (see "Table Compression"). This section describes the format of data blocks that use compression.
Assume that the rows in Example 12-2 are stored in a data block for the seven-column sales table.
Example 12-2 Rows in sales Table
2190,13770,25-NOV-00,S,9999,23,161
2225,15720,28-NOV-00,S,9999,25,1450
34005,120760,29-NOV-00,P,9999,44,2376
9425,4750,29-NOV-00,I,9999,11,979
1675,46750,29-NOV-00,S,9999,19,1121
Example 12-3 OLTP Compressed Rows in sales Table
2190,13770,25-NOV-00,S,%,23,161
2225,15720,28-NOV-00,S,%,25,1450
Table 12-1 conceptually represents the symbol table that maps symbols to values.
Table 12-1 Symbol Table
Symbol |
Value |
Column |
Rows |
* |
29-NOV-00 |
3 |
958-960 |
% |
9999 |
5 |
956-960 |
九. Space Management in Data Blocks
Note: This section assumes the use of automatic segment space management.
9.1 Percentage of Free Space in Data Blocks
CREATE TABLE test_table (n NUMBER) PCTFREE 20;
9.2 Optimization of Free Space in Data Blocks
While the percentage of free space cannot be less than PCTFREE, the amount of free space can be greater. For example, a PCTFREE setting of 20% prevents the total amount of free space from dropping to 5% of the block, but permits 50% of the block to be free space. The following SQL statements can increase free space:
(1)DELETE statements
(2)UPDATE statements that either update existing values to smaller values or increase existing values and force a row to migrate
(3)INSERT statements on a table that uses OLTP compression
If inserts fill a block with data, then the database invokes block compression, which may result in the block having more free space.
The space released is available for INSERT statements under the following conditions:
(1)If the INSERT statement is in the same transaction and after the statement that frees space, then the statement can use the space.
(2)If the INSERT statement is in a separate transaction from the statement that frees space (perhaps run by another user), then the statement can use the space made available only after the other transaction commits and only if the space is needed.
9.3 Coalescing Fragmented Space
Released space may or may not be contiguous with the main area of free space in a data block, as shown in Figure 12-10. Noncontiguous free space is called fragmented space.
Figure 12-10 Data Block with Fragmented Space
(1)An INSERT or UPDATE statement attempts to use a block that contains sufficient free space to contain a new row piece.
(2)The free space is fragmented so that the row piece cannot be inserted in a contiguous section of the block.
After coalescing, the amount of free space is identical to the amount before the operation, but the space is now contiguous. Figure 12-11 shows a data block after space has been coalesced.
Figure 12-11 Data Block After Coalescing Free Space
Oracle Database performs coalescing only in the preceding situations because otherwise performance would decrease because of the continuous coalescing of the free space in data blocks.
Figure 12-12 Index Before Coalescing
Figure 12-13 Index After Coalescing
Oracle Database must manage rows that are too large to fit into a single block. The following situations are possible:
(1)The row is too large to fit into one data block when it is first inserted.
In row chaining, Oracle Database stores the data for the row in a chain of one or more data blocks reserved for the segment. Row chaining most often occurs with large rows.
Examples include rows that contain a column of data type LONG or LONG RAW, a VARCHAR2(4000) column in a 2 KB block, or a row with a huge number of columns. Row chaining in these cases is unavoidable.
(2)A row that originally fit into one data block is updated so that the overall row length increases, but insufficient free space exists to hold the updated row.
In row migration, Oracle Database moves the entire row to a new data block, assuming the row can fit in a new block. The original row piece of a migrated row contains a pointer or "forwarding address" to the new block containing the migrated row. The rowid of a migrated row does not change.
(3)A row has more than 255 columns.
Oracle Database can only store 255 columns in a row piece. Thus, if you insert a row into a table that has 1000 columns, then the database creates 4 row pieces, typically chained over multiple blocks.
Figure 12-14 depicts shows the insertion of a large row in a data block. The row is too large for the left block, so the database chains the row by placing the first row piece in the left block and the second row piece in the right block.
Figure 12-15, the left block contains a row that is updated so that the row is now too large for the block. The database moves the entire row to the right block and leaves a pointer to the migrated row in the left block.
When a row is chained or migrated, the I/O needed to retrieve the data increases. This situation results because Oracle Database must scan multiple blocks to retrieve the information for the row.
For example, if the database performs one I/O to read an index and one I/O to read a nonmigrated table row, then an additional I/O is required to obtain the data for a migrated row.
The Segment Advisor, which can be run both manually and automatically, is an Oracle Database component that identifies segments that have space available for reclamation. The advisor can offer advice about objects that have significant free space or too many chained rows.
-------------------------------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
Email: dvd.dba@gmail.com
DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群: 83829929 DBA5群: 142216823
聊天 群:40132017 聊天2群:69087192
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
转载于:https://www.cnblogs.com/sqlite3/archive/2011/05/12/2568156.html
Oracle 数据块 Block 说明相关推荐
- Oracle的逻辑结构(表空间、段、区间、块)——Oracle数据块(一)
Oracle 的逻辑结构 ( 表空间.段.区间.块 ) --块 Oracle 存储数据的最小单位是数据块.Oracle 管理 数据库 数据文件的存储空间被称为数据块,一个数据块是数据库使用的最小数据单 ...
- Oracle数据块原理深入剖析
数据块(Oracle Data Blocks),本文简称为"块",是Oracle最小的存储单位,Oracle数据存放在"块"中.一个块占用一定的磁盘空间.特别注 ...
- oracle itl解析,oracle数据块dump文件中ITL详解
oracle数据块dump文件中ITL详解 dump出Oracle block后,可以看到事物槽,包含有事物槽号(ITL),XID,UBA,FLAG,LCK,SCN. 本文主要讨论FLAG标记的规则, ...
- Oracle数据块损坏的恢复实例
测试环境:11.2.0.4 1.构建数据块损坏的测试环境 2.有备份:常规恢复坏块 3.无备份:跳过坏块 1.构建数据块损坏的测试环境 1.1 创建测试表 --Create Table t_test ...
- oracle数据块坏,Oracle数据块损坏解决办法
背景: 1.PDM(Windchill)系统 2.exp数据错误,没有rman备份数据 3.数据库trc文件报错 Dump file d:\oracle\admin\wind\udump\wind_o ...
- oracle数据块格式小结
Oracle数据块可分为三层 更细化 Cache layer--20字节,包含DBA.块类型.块格式.SCN:数据块被读取时进行完整性检查,确保没有损坏或fracture,即块更新信息只有部分被写入 ...
- ORA-01578: ORACLE 数据块损坏 之奇妙处理 DBV
下午接到研发人员报告: ORA-01578: ORACLE 数据块损坏 根据网上诸多仁兄的处理方案,具体采用下面检查: ORA-01578: ORACLE 数据块损坏 (文件号 6, 块号 20) O ...
- oracle数据块损坏后的修复方法
关于oracle数据块损坏的解决方法,相关链接网址在: http://blog.csdn.net/dlinger/archive/2004/08/24/83911.aspx http://www.it ...
- oracle 数据块修复工具,BBED (Oracle Block Brower and EDitor Tool) :数据块修复工具
这个是关于BBED(Oracle Block Brower and EDitor Tool)使用介绍,这是Oracle一款内部 工具,可以直接修改Oracle数据文件块的内容,在一些极端恢复场景下比较 ...
最新文章
- 牛客网练习赛7--购物 动态规划
- 高薪进大厂 | 面试指南
- arduino 温度调节器_Arduino用温湿度传感器控制继电器,为什么点了串口助手才能运行,拔掉usb线,直接外界9V电源却用不了...
- leveldb——leveldb入门篇之Linux下编译配置和使用
- 解开Future的神秘面纱之任务执行
- 根据生日计算年龄 java_Java 根据出生日期获得年龄
- hdoj 1863 畅通工程 最小生成树---prime算法
- 附件文件超过了服务器的大小,Exchange 2010设置附件大小
- CAD图纸转换成高质量的彩色PDF格式如何操作?
- mysql批量导出工具_sql数据库批量导出|
- 查看计算机上硬盘的大小,怎么看硬盘的缓存信息?电脑硬盘缓存大小查看方法图解...
- jetbrains验证服务器,搭建个人jetbrains授权服务器
- 【ESP】乐鑫系列物联网芯片
- js php 获取时间倒计时_,JS实现获取时间和设置倒计时代码分享
- 用计算机里可以加50度电,一台电脑一天用多少度电?多少瓦?高配电脑一小时几度电?...
- 简述卡西欧5800p计算机,fx5800p
- 2017年大工考博英语加试试题。给学弟学妹们一点帮助
- solr dih有子查询时速度慢
- 报错: Called “net usershare info“ but it failed
- thinkpad 10 linux驱动,Ubuntu 10.04安装Thinkpad指纹软件