#ASM Translation Series 22: ASM Internal ASM file number 8

Keywords: SQL Database

Original text: ASM file number 8
Author: Bane Radulovic
Translator: Guo Xurui, Warbury Technology Product Delivery Manager, is responsible for the overall delivery management, technical support and maintenance services of QData Cloud high-performance database cloud platform, QBackup database second-level backup recovery cloud platform and other products.
Revision: Wei Xinghua
Editorial Responsibility: Zhong Peiyi

ASM Meta Information 8 file is the disk space usage directory, USD, which records the number of AUs used on each zone of each disk in each ASM disk group. A disk zone contains hot zone-hot zone and cold zone-cold zone. The USD directory provides an entry for each disk, and the entry information records the number of AUs used by two zones (COLD and HOT).

The USD structure was introduced in version 11.2 and is related to the intelligent data storage feature. USD metadata files exist when ASM compatibility parameters are set above 11.2.

Locating the used space directory

We retrieve the AU of the USD directory in each disk group through the following query.

SQL> break on Group#
SQL> SELECT d.group_number "Group#",
 x.disk_kffxp "Disk#",
 x.xnum_kffxp "Extent",
 x.au_kffxp "AU",
 d.name "Disk name"
FROM x$kffxp x, v$asm_disk_stat d
WHERE x.group_kffxp=d.group_number
 and x.disk_kffxp=d.disk_number
 and x.number_kffxp=8
ORDER BY 1, 2;

 Group#  Disk#  Extent     AU Disk name
------- ------ ------- ------ ------------
      1      0       0     51 ASMDISK5
             1       0     51 ASMDISK6
      2      0       0     41 ASMDISK1
             2       0     39 ASMDISK3
             3       0     38 ASMDISK4

Check the allocation of available space for each disk in all disk groups.

SQL> SELECT group_number "Group#",
 name "Disk name",
 hot_used_mb "Hot (MB)",
 cold_used_mb "Cold (MB)"
FROM v$asm_disk_stat
ORDER BY 1;

 Group# Disk name      Hot (MB)  Cold (MB)
------- ------------ ---------- ----------
      1 ASMDISK5              0       4187
        ASMDISK6              0       4187
      2 ASMDISK4              0       1138
        ASMDISK2              0       1135
        ASMDISK1              0       1139
        ASMDISK3              0       1144

The above results show that all space on each disk is allocated in the cold zone. Let's take a closer look with the kfed tool.

$ kfed read /dev/oracleasm/disks/ASMDISK5 aun=51 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                           26 ; 0x002: KFBTYP_USEDSPC
...
kfdusde[0].used[0].spare:             0 ; 0x000: 0x00000000
kfdusde[0].used[0].hi:                0 ; 0x004: 0x00000000
kfdusde[0].used[0].lo:             4134 ; 0x008: 0x00001026
kfdusde[0].used[1].spare:             0 ; 0x00c: 0x00000000
kfdusde[0].used[1].hi:                0 ; 0x010: 0x00000000
kfdusde[0].used[1].lo:                0 ; 0x014: 0x00000000
kfdusde[1].used[0].spare:             0 ; 0x018: 0x00000000
kfdusde[1].used[0].hi:                0 ; 0x01c: 0x00000000
kfdusde[1].used[0].lo:             4134 ; 0x020: 0x00001026
kfdusde[1].used[1].spare:             0 ; 0x024: 0x00000000
kfdusde[1].used[1].hi:                0 ; 0x028: 0x00000000
kfdusde[1].used[1].lo:                0 ; 0x02c: 0x00000000
kfdusde[2].used[0].spare:             0 ; 0x030: 0x00000000
kfdusde[2].used[0].hi:                0 ; 0x034: 0x00000000
kfdusde[2].used[0].lo:                0 ; 0x038: 0x00000000
kfdusde[2].used[1].spare:             0 ; 0x03c: 0x00000000
kfdusde[2].used[1].hi:                0 ; 0x040: 0x00000000
kfdusde[2].used[1].lo:                0 ; 0x044: 0x00000000

The output of the kfed tool above shows that there are two disks in ASM disk group I, so only the first two entries of the kfdusde structure are occupied (kfdusde[0], kfdusde[1]), and both entries show that all allocated space is in the cold zone.

View the space usage records of disk group 2:

$ kfed read /dev/oracleasm/disks/ASMDISK1 aun=41 | more
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                           26 ; 0x002: KFBTYP_USEDSPC
...
kfdusde[0].used[0].spare:             0 ; 0x000: 0x00000000
kfdusde[0].used[0].hi:                0 ; 0x004: 0x00000000
kfdusde[0].used[0].lo:             1092 ; 0x008: 0x00000444
kfdusde[0].used[1].spare:             0 ; 0x00c: 0x00000000
kfdusde[0].used[1].hi:                0 ; 0x010: 0x00000000
kfdusde[0].used[1].lo:                0 ; 0x014: 0x00000000
kfdusde[1].used[0].spare:             0 ; 0x018: 0x00000000
kfdusde[1].used[0].hi:                0 ; 0x01c: 0x00000000
kfdusde[1].used[0].lo:             1093 ; 0x020: 0x00000445
kfdusde[1].used[1].spare:             0 ; 0x024: 0x00000000
kfdusde[1].used[1].hi:                0 ; 0x028: 0x00000000
kfdusde[1].used[1].lo:                0 ; 0x02c: 0x00000000
kfdusde[2].used[0].spare:             0 ; 0x030: 0x00000000
kfdusde[2].used[0].hi:                0 ; 0x034: 0x00000000
kfdusde[2].used[0].lo:             1098 ; 0x038: 0x0000044a
kfdusde[2].used[1].spare:             0 ; 0x03c: 0x00000000
kfdusde[2].used[1].hi:                0 ; 0x040: 0x00000000
kfdusde[2].used[1].lo:                0 ; 0x044: 0x00000000
kfdusde[3].used[0].spare:             0 ; 0x048: 0x00000000
kfdusde[3].used[0].hi:                0 ; 0x04c: 0x00000000
kfdusde[3].used[0].lo:             1094 ; 0x050: 0x00000446
kfdusde[3].used[1].spare:             0 ; 0x054: 0x00000000
kfdusde[3].used[1].hi:                0 ; 0x058: 0x00000000
kfdusde[3].used[1].lo:                0 ; 0x05c: 0x00000000
kfdusde[4].used[0].spare:             0 ; 0x060: 0x00000000
kfdusde[4].used[0].hi:                0 ; 0x064: 0x00000000
kfdusde[4].used[0].lo:                0 ; 0x068: 0x00000000
kfdusde[4].used[1].spare:             0 ; 0x06c: 0x00000000
kfdusde[4].used[1].hi:                0 ; 0x070: 0x00000000
kfdusde[4].used[1].lo:                0 ; 0x074: 0x00000000
...

Group 2 has four disks, four entries are occupied, and all the space allocated to each disk is indeed allocated to the cold zone.

Hot files

Let's create a disk group template that specifies that all files created based on this template should be in the hot area of the disk.

SQL> alter diskgroup DATA add template HOTFILE attributes (HOT);

Diskgroup altered.

This feature requires that the compatible.rdbms property of the disk group be set to 11.2 or more.

Now create a data file and place it in the hot zone.

SQL> create tablespace T1_HOT datafile '+DATA(HOTFILE)' size 50M;

Tablespace created.

Run the above query again to check space usage.

SQL> SELECT group_number "Group#",
 name "Disk name",
 hot_used_mb "Hot (MB)",
 cold_used_mb "Cold (MB)"
FROM v$asm_disk_stat
ORDER BY 1;

    Group# Disk name                        Hot (MB)  Cold (MB)
---------- ------------------------------ ---------- ----------
         1 ASMDISK5                                0       4187
           ASMDISK6                                0       4187
         2 ASMDISK4                               13       1152
           ASMDISK2                               12       1153
           ASMDISK1                               13       1152
           ASMDISK3                               13       1153

The above results show that 51MB of space (50MB for the file itself and 1MB for the file header) is allocated in the hot zone and distributed among all disks in the disk group.

Warm up a file

We can also move an existing data file to the hotspot. We can find all the data files in the disk group DATA through the find command in asmcmd:

$ asmcmd find --type datafile +DATA "*"
+DATA/BR/DATAFILE/EXAMPLE.269.769030517
+DATA/BR/DATAFILE/NOT_IMPORTANT.273.771795255
+DATA/BR/DATAFILE/SYSAUX.257.769030245
+DATA/BR/DATAFILE/SYSTEM.256.769030243
+DATA/BR/DATAFILE/T1_HOT.274.772054033
+DATA/BR/DATAFILE/TRIPLE_C.272.771794469
+DATA/BR/DATAFILE/TRIPLE_M.271.771793293
+DATA/BR/DATAFILE/UNDOTBS1.258.769030245
+DATA/BR/DATAFILE/USERS.259.769030245

Now let's move the data file from the undo table space into the hot zone.

SQL> alter diskgroup DATA modify file '+DATA/BR/DATAFILE/UNDOTBS1.258.769030245' attributes (HOT);

Diskgroup altered.

This command triggers the rebalance of the disk group DATA once, because the file extent s need to be moved to the hot zone of the disk. When rebalance ends, the query finds more data in the hotspot.

Translator's Note: Although it is rebalance of disk group, it will be faster, depending only on the size of undo file, because other files themselves are rebalance state, only need to do a quick check, and there is no real large number of extent s need to be moved.

SQL> SELECT group_number "Group#",
 name "Disk name",
 hot_used_mb "Hot (MB)",
 cold_used_mb "Cold (MB)"
FROM v$asm_disk_stat
ORDER BY 1;

    Group# Disk name                        Hot (MB)  Cold (MB)
---------- ------------------------------ ---------- ----------
         1 ASMDISK5                                0       4187
           ASMDISK6                                0       4187
         2 ASMDISK4                               40       1125
           ASMDISK2                               39       1126
           ASMDISK1                               39       1126
           ASMDISK3                               39       1127

Conclusion

The ASM Meta Information 8 file, the disk space usage directory, records the number of AU usage per zone per disk on each ASM disk group. It supports the intelligent data storage feature in version 11.2. One possible use of this feature is that we can control the storage of data in cold and hot zones.

Translator's Note: For virtual disks that have RAID or are exported through storage, the hot and cold zones of the disks will be useless, as will SSD disks.

Posted by V34 on Wed, 19 Dec 2018 17:39:05 -0800