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 on which the data is stored.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. 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 . ■BBBBBB The data block number identifies the block that contains the row. 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. ■RRR The row number identifies the row in the block
elect rowid ,
dbms_rowid.rowid_object(rowid) obj_id# ,
dbms_rowid.rowid_relative_fno(rowid) rfile# ,
dbms_rowid.rowid_block_number(rowid) block# ,
dbms_rowid.rowid_row_number(rowid) row#
from t
--rfile#就可以使用dba_data_files表查看它的具体位置.
oracle 在物理上的结构 是 数据块- 文件-表空间。
dbms_rowid.rowid_block_number(rowid) block# , 就是查块号 ,你的意思难道是指直观(肉眼可看的)?
■OOOOOO
The data object number identifies the segment. 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 .
■BBBBBB
The data block number identifies the block that contains the row. 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.
■RRR
The row number identifies the row in the block
rowid是行的唯一标识,包含了段、数据文件、数据块、行号这些信息,相当于一个地址
rowid的一大用途是索引,索引将列值按顺序排列,并存储行的rowid,对应到表中的相应位置不知道你这里的物理地址指的是什么,如果是问如何通过rowid来进行磁盘的寻址,那就是操作系统底层的东西了
你可以去看一下
表空间,段,区,块这些概念话说我看完没几天自己都忘记了
一个数据库文件就是一个块,读取块 是通过物理地址从磁盘获取。
然后加载到内存,在块里找rowid对应的数据,rowid是指逻辑地址,此时数据都已经在内存里了,已经不需要什么读取磁盘了
一个数据库文件就是一个块,读取块 是通过物理地址从磁盘获取。
然后加载到内存,在块里找rowid对应的数据,rowid是指逻辑地址,此时数据都已经在内存里了,已经不需要什么读取磁盘了 rowid是逻辑地址,那块的物理地址怎么来的?