Understanding oracle ROWID

Source: Internet
Author: User


Understand that oracle ROWID data is stored in a data file, and its attributes are determined by the storage. These attributes include: in which data file? Which object does it belong? Where is the data block? Row number? These attributes are combined to form the ROWID of oracle. Therefore, rowid records the data location on the disk in detail. Www.2cto.com ROWID can be divided into physical and logical values. Except that IOT uses the logical ROWID, other types of tables use the physical ROWID. ROWID can also be divided into: Limited and extended. Use the extended rowid after 8i. The following describes the extended rowid. Extended rowid, which adopts 64-bit encoding and is enabled by 6 and 3. Example: [SQL] SQL> show user USER user is "HR" SQL> drop table t1 purge; drop table t1 purge * row 1st error: ORA-00942: the table or view does not have SQL> create table t1 (id number, name varchar2 (20); the table has been created. Www.2cto.com SQL> insert into t1 values (1, 'A'); 1 row has been created. SQL> insert into t1 values (2, 'B'); 1 row has been created. SQL> commit; submitted completely. SQL> select rowid, t1. * from t1; rowid name ------------------ ---------- bytes aaanfgaaeaahyaaa 1 a aaanfgaaeaahyaab 2 B ROWID 64 encoded table base64 represents the numerical order ~ Z 0 ~ 25a ~ Z 26 ~ 510 ~ 9 52 ~ 61 + 62/63 id = 1 the corresponding rowid is: AAANFg aae aaaahy aaa AAANFg: www.2cto.com segment number (corresponding to data_object_id of dba_data_files ). Note the difference between object_id and object_id. Object_id is the Object ID card. It uniquely identifies an object. It is different from the segment number. The segment must be an object, but the object is not necessarily a segment ). The physical location is changed. For example, if the tablespace is moved, the data_object_id is also changed. If the object name is changed, object_id is not affected. Truncate also changes the segment number. Because truncate is a DDL statement, the table metadata is deleted from the data dictionary and HWM is removed, but the data is not deleted. From the table above, you can obtain: A = 0 N = 13 F = 5g = 32 [SQL] SQL> select 13 * power (64, 2) + 5*64 + 32 from dual; 13 * POWER (64, 2) + 5*64 + 32 -------------------- 53600 we can also use the dbms_rowid package to find: [SQL] SQL> select transform ('aaanfgaaeaahyaaaaa ') from dual; DBMS_ROWID.ROWID_OBJECT ('aaanfgaaeaahyaaa') ----------------------------------------------- 53600 www.2cto.com AAE relative file number (relative_fno), table space level. Pay attention to the difference from the absolute file number (file_id) at the database level.
The position of row ROWID in oracle is self-evident. The essence of an index is to use ROWID, because the index stores the rowid and then locates the record in the data table based on the rowid. Imagine a book where the index is a directory and the book content is data, then rowid is the "page number" that contacts the Directory and content ".
Author: linwaterbin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.