oracle se lect 中文乱码,Oracle rowid

Oracle rowid

一:

rowid

组成

(1)The data object number of the object

(2)The data block in the data file in which the row resides

(3)The position of the row in the data block (first row is 0)

(4)The data file in which the row resides (first file is 1). The file number is relative to the tablespace.

二:

rowid

重要用途

Rowid values have several important uses:

(1)They are the fastest way to access a single row.

(2)They can show you how the rows in a table are stored.

(3)They are unique identifiers for rows in a table.

三:

rowid

限制

Small Datafile

Max(一个表空间的数据文件数)=(2^10)-1=1023

Max(

一个数据文件包含块数

)=2^22=4194304=4M(block)

Max(

一个

block

包含行数

)=2^16=65536=64k(rows)

Max(一个数据库内object

个数

)=2^32=4294967296=4G(objects)

Bigfile Datafile

Max(一个表空间的数据文件数)=1

Max(

一个数据文件包含块数

)=2^(22+10)=4294967296=4G(block)

Max(

一个

block

包含行数

)=2^16=65536=64k(rows)

Max(一个数据库内object

个数

)=2^32=4294967296=4G(objects)

测试如下:

(1)

创建测试数据

SQL> create tablespace chenjch_tbs datafile '/u01/app/oracle/oradata/cc/chenjch_tbs01.dbf' size 10M autoextend on maxsize 1G;

SQL> create user chenjch identified by a default tablespace chenjch_tbs;

SQL> grant connect,resource,dba to chenjch;

SQL> create table t1 as select * from scott.emp;

SQL> create table t2 as select * from scott.dept;

(2)

查看

t1

rowid

信息

SQL> SELECT rowid,empno from t1 a order by empno;

700e1a0c1d7acc191be38d8e2c44cb6c.png

SQL>

select substr(rowid, 1, 6) "object",

substr(rowid, 7, 3) "file",

substr(rowid, 10, 6) "block",

substr(rowid, 16, 3) "row"

from t1;

---取出任意一行rowid

AAAVV9 AAF AAAACD AAC

---通过rowid计算对应的obj#,rfile#,block#,row#;

(1)obj#=AAAVV9=21*64^2+21*64+61=

87421

(2)rfile#=AAF=

5

(3)block#=AAAACD=2*64+3=

131

(4)row#=AAC=

2

d3e0f28f51c1c4e9130fedf62cd5babf.png

---

也可以通过dbms_rowid转换得到相应的

obj#,rfile#,block#,row#;

SQL>

se

lect dbms_rowid.rowid_object(rowid) object_id,

dbms_rowid.rowid_relative_fno(rowid) file_id,

dbms_rowid.rowid_block_number(rowid) block_id,

dbms_rowid.rowid_row_number(rowid) row_number,

ROWID,

empno

from T1

order by empno;

d67ab22c1374551febcf31bf775451ff.png

(3)rowid

和限制

Small Datafile

rowid

采用

10

byte

来存储

=8*10=80bit

其中

:

obj#

占用

32bit

rfile#

占用

10bit

block#

占用

22bit

row#

占用

16bit

Max(一个表空间的数据文件数)=(2^10)-1=1023

Max(

一个数据文件包含块数

)=2^22=41943044=4M(block)

Max(

一个

block

包含行数

)=2^16=65536=64k(rows)

Max(一个数据库内object

个数

)=2^32=4294967296=4G(objects)

Bigfile Datafile

rowid

采用

10

byte

来存储

=8*10=80bit

其中

:

obj#

占用

32bit

rfile#

占用

0bit

block#

占用

32bit

row#

占用

16bit

Max(一个表空间的数据文件数)=2^0=1

Max(

一个

block

包含行数

)=2^16=65536=64k(rows)

Max(一个数据库内object

个数

)=2^32=4294967296=4G(objects)

欢迎关注我的微信公众号"IT小Chen",共同学习,共同成长!!!

ecc88c720aeb434a3c7641a2ea303364.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值