[Algorithm for maximum data file size supported by table space] [database limit] [number of data parts retained in the data file header]

Source: Internet
Author: User
Tags types of tables


When db_block_size is set to different sizes in the local tablespace, the reserved data file header space is as follows :--?? Db_block_size = 2 kb. the file header contains 32 data blocks, that is, 64 KB.
Db_block_size = 4 kb. the file header contains 16 data blocks, that is, 64 KB.
Db_block_size = 8 KB. the file header contains 8 data blocks, that is, 64 KB.
Db_block_size = 16 KB. the file header contains 4 data blocks, that is, 64 KB.
Db_block_size = 32 KB. the file header contains four data blocks, that is, kb. -- Why not 64 kB?
The default value is db_block_size = 8 KB. The eight data blocks in the ORACLE Data File Header are used as follows:

Data blocks 1 and 2 record the data file header information. 3-8: used to record bitmap information of extent-Range

Extent management local uniform size 256 K -- allocate each extent with a minimum size of K blocks and a minimum size of 8.

Is each extent allocated with at least X blocks? Assume that db_block_size = 16 KB, and the file header retains 4 data blocks, that is, 64 KB.

4 M <= X * 64 k * 8

X> = 8

-- Each data file has a maximum of 4 MB blocks. Each bit in the reserved data block indicates the Usage Status of X blocks, and the data block needs to be stored in a status of 4 MB.



The maximum data file size supported by the tablespace algorithm:

There are two scenarios: smallfile tablespace and bigfile tablespace.
The rowid record of the smallfile tablespace stores the database object, the data file (file #), and the row number in the data block. These attributes are combined to form the oracle rowid.
Oracle rowid is divided into physical ROWID and logical ROWID. --??
The index organization table (IOTs) uses the logical ROWID, while other types of tables use the physical ROWID.
ROWID can uniquely identify a record. Therefore, the ROWID value is stored in the index. You can access the index to obtain the ROWID and then locate the record.

ROWID is Base64 encoded. A total of 18 bits represent the number of 80 bits, occupying 10 bytes. -- 1 Byte = 8bit
Each group of characters represents a different meaning. The 18-bit maximum addressing space is "32 GB ".. --??
Parsing a row ID: OOOOOO. FFF. BBBBBB. RRR -- rowid structure 6-3-6-3
OOOOOO: 1-6 bits: Object id -- generally referred to as segment number
FFF: 7-9 bits: File id
BBBBBB: 10-15 digits: block id
RRR: 16-18 bits: Row id
For Base64 encoding, a total of 18 bits represent the number of 80 bits. The calculation method is as follows:
32bit obj # + 10bit file # + 22bit block # + 16bit row #

Use ROWID to calculate data block correlation

Http://blog.csdn.net/hughwang1216/article/details/12927701

Http://blog.csdn.net/hughwang1216/article/details/11871305


Max. Algorithm Remarks Lab Test
Maximum number of files in a tablespace 2 ^ 10 [1 K] Remove all 0 1023
Maximum number of data blocks per data file 2 ^ 22-1 [4 M] Remove all 0 4194304
Number of rows per BLOKC 2 ^ 16 [64 k] Remove all 0  
Maximum number of database objects 2 ^ 32 [4G] Remove all 0  



Each database can contain up to 64 K data files and a maximum of 64 K tablespaces, because each tablespace must contain at least one data file.

--The official document is 65533. How can this problem be calculated ??


New questions:If the database has more than 1024 data files, How Does ORACLE use ROWID to locate the data files? 

After more than 1023 data files exist, oracle will ensure that the file_id is unique throughout the database, and relative_fno is unique in a single tablespace.

Then there will be a problem. How Does oracle, a data file with the same and relative file numbers in different tablespaces, distinguish them?

32bit obj # + 10bit file # + 22bit block # + 16bit row # follow the instructions below

Data_object_id, rfn, block #, row #.

A data file can belong to only one tablespace. By combining data_object_id with the data dictionary view, oracle can know which tablespace to point to and convert rfn to file_id, in this way, you can locate rows accurately.

Data_object_id (generally segment number)-> which tablespace belongs->Relative_fno->File_id



For more detailed database restrictions, see the official documentation: http://docs.oracle.com/cd/B19306_01/server.102/b14237/limits.htm#REFRN004 --??


The rowid of the bigfile tablespace is not required in the ROWID because the large file tablespace can only contain one file.
The ROWID format of the large file tablespace is:
OOOOOO. LLLLLLLLL. RRR
OOOOOO: 1-6 bits: Object id
LLLLLLLLL: 7-15 digits: block id
RRR: 16-18 bits: Row id

L represents the BLOCK number, instead of the file # + block # In the ROWID of the small file tablespace.

For Base64 encoding, a total of 18 bits represent the number of 80 bits. The calculation method is as follows:

32bit obj # + 32 bitfile & block # + 16bit row #

In this way, large file tablespace data files supportMaximum number of blocks: 2 ^ 32 = 4G.



When smallfile tablespace is set to db_block_size of different sizes, the maximum data file size allowed is db_block_size = 2KB, 2KB * 4 M = 8192 M 8G.
Db_block_size = 4 kb, 4 kb * 4 M = 16384 M 16G
Db_block_size = 8 KB, 8 KB * 4 M = 32768 M 32G 8*1024*4 M = 8*4G = 32G
Db_block_size = 16 KB, 16 KB * 4 M = 65536 M 64G
Db_block_size = 32 KB, 32 KB * 4 M = 131072 M 128G


Bigfile tablespace: set the maximum size of the data file db_block_size = 2KB, 2KB * 4G = 8 T when db_block_size is different.
Db_block_size = 4KB, 4KB * 4G = 16 T
Db_block_size = 8 KB, 8 KB * 4G = 32 T 8*1024*4G = 8*4 TB = 32 TB
Db_block_size = 16 KB, 16 KB * 4G = 64 T
Db_block_size = 32KB, 32KB * 4G = 128 TB


Related Article

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.