Research on freelists and Freelist groups (revised edition)-where is the freelists storage

Source: Internet
Author: User
Tags dba header sql
Three              Where the freelists is stored freelists stored in the header block of each segment, we can get a clearer idea by dump. Dump usually plays an important role in the study of Oracle's internal mechanisms. Let's say we create a tablespace ts_test, this table space is not automatic segment space managed, and then create t_manual,t_manual_free2,t_manual_freegroup2 three tables in the tablespace. The freelists and freelist groups of these three sheets are set as follows.  SQL> Select Segment_name,segment_type,freelists,freelist_groups from user_segments where Tablespace_name= ' Ts_test '; segment_name         segment_type         freelists freelist_groups-------------------------------------------------------------- -t_manual             TABLE                        1                1t_manual_free2        TAble                        2                1t_manual_freegroup2  table                        4                2  You can dump the segment header block by reference to the following methods. First, the file number of this segment is stored in the data dictionary and the first block number of this segment (that is segment header block)  SQL> Select file_id,block_id from DBA _extents where segment_name= ' t_manual ';    file_id   block_id--------------------          7          9  Dumping the contents of this block using the dump command, the result of the dump is saved in the directory specified by the initialization parameter user_dump_dest.  SQL> alter system dump DATAFILE 7 block 9; system altered  View User_dump_The corresponding trace file in the Dest directory, we can see the following lines: frmt:0x02 chkval:0x0000 type:0x10=data SEGMENT header–unlimited says this block is SEGMENT Header block. #blocks in SEG. HDR ' s freelists:2     #blocks below:2 indicates that there are 2 blocks of data in freelist, and there are 2 blocks of data under the high watermark (HWM). SEG LST:: flg:used   lhd:0x01c0000a ltl:0x01c0000b as we dump the header block of the Ts_manual table, the freelists= of this table 1, so in the dump file see only one seg lst, this freelist is called segment free list or master free list, each segment has at least one and only one master free List (of course, under non-automatic segment space management type). FLG (flag) indicates whether the freelist is used LHD (list header) to represent the DBA (Data block address) LTL in the first available block in the list (list Tail) represents the DBA of the last available block in the list, which must be located under HWM. At this point we can see that freelists only records the first block address and the last block address of the free block in this segment, and the address of the next free block after it is recorded at the block header of the first free chunk. The next free block also records the address of the next free block, which is recorded sequentially until the last free block. Oracle has realized the management of freelists for idle blocks through the way of this linked list.   NOTE: Each time a block is added to the free list, the block is placed in the head of the list in the free list.   Also we can dump the first free block to verify the list above. For example, the DBA in the LHD section is 0x01c0000a, which is a 16-digit number, first converted to 10, and then 29360138. Then the two functions provided by Oracle translate the block address into the file number and block number that we can use so that IFor the dump operation.  SQL> Select Dbms_utility.data_block_address_file (29360138) from Dual; dbms_utility. Data_block_addres------------------------------                              7  SQL> Select Dbms_utility.data_block_address_block (29360138) from Dual; dbms_utility. Data_block_addres------------------------------                             10  Now we've got the first free block is number 7th, block 10th. Dump the contents of this block with the dump command mentioned earlier, we can find the following: fnx:0x1c0000b represents the next available block address is 0x1c0000b, in our example this block is exactly the last block available (segment header Block LHD part), we can dump this 0x1c0000b again, and look at the result of the dump, and find the following: fnx:0x00x0 means there is no free block below, which means that this is the last free block in the freelists.   NOTE: Your test may get a different dump content, which is normal.

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.