ASM_info.sql

I’ve decided to write a simple sql script that uses +ASM instance and shows some useful information regarding ASM datafile allocation map for some datafile (Yes, you need to know datafile name..twice :-). It also gives you some more basic information.

SQL> @asm_info.sql;

asm_info.sql v1.0 by Luis Marques lcarapinha@gmail.com - http://lcmarques.com


================= ASM DISKGROUP SUMMARY ===============================

ASM_DISKGROUP ASM_DISKNUMBER STATE    REDUNDANCY Free/Total(MB)  PATH
------------- -------------- -------- ---------- --------------- ------------------------------
            1              0 NORMAL   UNKNOWN    4422/8189       /dev/oracleasm/disks/BACKUP
            2              0 NORMAL   UNKNOWN    1929/5114       /dev/oracleasm/disks/DISK1
            2              1 NORMAL   UNKNOWN    1975/5114       /dev/oracleasm/disks/DISK2
            2              2 NORMAL   UNKNOWN    1980/5114       /dev/oracleasm/disks/DISK3
            2              3 NORMAL   UNKNOWN    1948/5114       /dev/oracleasm/disks/DISK4
            2              4 NORMAL   UNKNOWN    1980/5114       /dev/oracleasm/disks/DISK5

6 rows selected.

=============== SPFILE INFORMATION ==================================

GROUP_NUMBER RELATIVE_AU_POS FILE_EXTENT_NUMBER PATH                                BYTES
------------ --------------- ------------------ ------------------------------ ----------
           0            1408                  0 /dev/oracleasm/disks/BACKUP          2560
           3             403                  0 /dev/oracleasm/disks/DISK4           4608

================= ASM DATAFILE ALLOCATION MAP ==========================
Control+C and Enter to cancel...
Enter value for datafile: ts_dbc.df
Enter value for datafile: ts_dbc.df

ASM_DISKGROUP ASM_DISKNUMBER ASM_FILENUMBER FILE_EXTENTNUMBER RELATIVE_AU_POS
------------- -------------- -------------- ----------------- ---------------
            2              1            269                 1             451
            2              1            269                11             452
            2              1            269                16             453
            2              3            269                 3             454
            2              1            269                 6             454
            2              3            269                 8             455
            2              4            269                 0             456
            2              2            269                 2             456
            2              3            269                13             456
            2              4            269                 5             457
            2              3            269                18             457
            2              4            269                10             458
            2              4            269                15             459
            2              2            269                 7             461
            2              2            269                12             462
            2              2            269                17             463
            2              4            269                20             464
            2              0            269                 4             486
            2              0            269                 9             487
            2              0            269                14             488
            2              0            269                19             489

21 rows selected.

This can help you track datafile into ASM filesystem, RELATIVE_AU_POS shows the relative position of the AU from the beginning of the disk.

In this example the first MB (1MB AU) is located at block 451 and goes until block 489. You can use dd directly to query “datafile” contents. Example:

dd if=/dev/oracleasm/disks/DISK1 bs=1024k count=1 skip=451|strings|more

Script is available on GitHub.

PS: I will eventually provide more information about it as soon as possible 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s