oracle rowid
Oracle rowid
一:rowid組成
https://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements001.htm#SQLRF00213
https://docs.oracle.com/cd/E11882_01/server.112/e41084/pseudocolumns008.htm#SQLRF00254
(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重要用途
https://docs.oracle.com/cd/E11882_01/server.112/e41084/pseudocolumns008.htm#SQLRF00254
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;
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
---也可以通過dbms_rowid轉換得到相應的obj#,rfile#,block#,row#;
SQL>
select 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;
(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)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2154425/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【ROWID】Oracle rowid說明Oracle
- ORACLE ROWID (zt)Oracle
- oracle常用包之dbms_rowid oracle rowid含義分析Oracle
- oracle rowid詳解Oracle
- Oracle rowid 詳解Oracle
- Oracle ROWID-1Oracle
- Oracle ROWID-2Oracle
- oracle rowid (轉載)Oracle
- oracle rowid 的含義Oracle
- Oracle中rowid的用法Oracle
- 【oracle中rowid的用法】Oracle
- Oracle 透過rowid秒優SQLOracleSQL
- Oracle 通過rowid秒優SQLOracleSQL
- oracle8的ROWID結構Oracle
- oracle中的Rowid和UrowidOracle
- 【TUNE_ORACLE】ROWID切片SQL參考OracleSQL
- oracle中rownum和rowid的區別Oracle
- oracle壞塊的rowid方式修復Oracle
- oracle8的ROWID結構(轉)Oracle
- Oracle redo解析之-4、rowid的計算Oracle Redo
- oracle 表中的rowid是什麼意思Oracle
- 【oracle rowid與rownum的使用與區別 】Oracle
- Oracle資料庫開發——瞭解rowidOracle資料庫
- oracle實驗記錄 (dbms_rowid使用)Oracle
- Oracle中rownum與rowid使用上的問題Oracle
- dbms_rowid之dbms_rowid.rowid_info儲存過程使用(in out)儲存過程
- ROWID簡介
- ROWID詳解
- Oracle 12c新特性之——TABLE ACCESS BY INDEX ROWID BATCHEDOracleIndexBAT
- oracle單條sql與plsql rowid插入記錄小記OracleSQL
- 轉---DBMS_ROWID.ROWID_CREATE來解決壞塊
- MySQL中的_rowidMySql
- Oracle中的ROWID實現(r10筆記第95天)Oracle筆記
- rowid一點總結
- Datatypes (1) : ROWID and UROWID
- Oracle基本資料型別儲存格式淺析(四)——ROWID型別Oracle資料型別
- 索引ROWID轉換函式索引函式
- 關於rowid的應用