Research on Freelists and Freeelist Groups (Revised) - FreeLists Store

xiaoxiao2021-03-06  14

three.

Freelists

Where is stored?

Freeelists are stored in each Segment's Header Block, we can get a clearer understanding through dump. DUMP usually plays an important role when studying Oracle's internal mechanisms.

Suppose we create a table space TS_TEST, this table space is non-automatic segment space management, then create T_manual, T_manual_Free2, T_manual_FreeGroup2 three tables in the table space. The three tables of Freelists and Freeelist Groups are set below.

SQL> Select segment_name, segment_type, freeelists, freeelist_groups from user_segments where tablespace_name = 'ts_test';

Segment_name segment_type freeelists freeelist_groups

------------------------------------ -------------

T_manual Table 1 1

T_manual_free2 Table 2 1

T_manual_freegroup2 Table 4 2

The Segment Header Block is dump operations with the following method.

First get the first Block number that stores this segment file number and this segment's first Block number (also segment header block) from the data dictionary.

SQL> SELECT FILE_ID, block_id from dba_extents where segment_name = 't_manual';

FILE_ID BLOCK_ID

---------- ----------

7 9

Use the dump command to dump this block content, the result of the dump will be saved in the directory specified in the initialization parameter user_dump_dest.

SQL> ALTER SYSTEM DUMP DATAFILE 7 block 9;

SYSTEM altered

View the corresponding trace file in the user_dump_dest directory, we can see the following lines:

FRMT: 0x02 Chkval: 0x0000 TYPE: 0x10 =

Data segment header - unlimited

Said that this block is Segment Header Block.

#blocks in seg. HDR's FreeElists:

2

#Blocks Below:

2

It is shown that there are 2 data blocks located in FreeList, and there are 2 data blocks under high water level flags (hwm).

Seg Lst :: flg: used lhd: 0x01c0000a ltl: 0x01c0000b

Since we dump is the Header Block of the TS_manual table, and this table's freeLists = 1, so I saw that there is only one seg LST in the dump file, which is called Segment Free List or Master Free List, each segment is at least There is one and only one master free list (of course, under the type of non-automatic space management type).

FLG (FLAG) indicates whether the Freelist is used to represent the first Block DBA (Data Block Address) located in this list.

LTL (List Tail) represents the last available Block's DBA, which is located in HWM.

At this point, we can find that Freelists just recorded the first block address of this segment hollow blouse and the last block address, and recorded the next idle block after the block of the first idle block (block header). , The next idle block records the address of the next idle block, which is recorded in turn, until the last idle block. Oracle implements the management of FreeLists for free blocks in a manner in this linked list.

Note: Each time a block is added to the Free List, the block is placed in the list header of Free List.

Also we can Dump first idle blocks to verify the above chain list.

For example, the DBA recorded in the LHD portion is 0x01C0000A, which is a 16-based number, first transforming to 10 binders, so it is 29360138. Then convert the block address to the file number and block number provided by Oracle to us for our Dump operation.

SQL> SELECT DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE (29360138) from DUAL

DBMS_UTILITY.DATA_BLOCK_ADDRES

------------------------------

Seduce

SQL> SELECT DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK (29360138) from DUAL

DBMS_UTILITY.DATA_BLOCK_ADDRES

------------------------------

10

Now we have got the first idle block 10 block No. 7 file. Use the previously mentioned dump command DUMP this block of this block, we can find the following:

FNX: 0x1C0000B

Indicates that the next available block address is 0x1C0000B, in our example this block is exactly the last block available (the LHD portion in Segment Header Block), we can Dump this 0x1c0000B block, look at the result of the dump, find below Content:

FNX: 0x0

0x0 indicates that there is no empty block that is available below, that is, this is the last idle block in Freelists.

Note: Your test may get a different dump content with me, this is normal.

转载请注明原文地址:https://www.9cbs.com/read-49181.html

New Post(0)