V$ASM_DISKGROUP displays information from the header of ASM disks
Posted by Kamran Agayev A. on January 17th, 2014
While playing with OCR recovery, suddenly I realized that V$ASM_DISKGROUP view gets information from the headers of the ASM disk files that are specified at *.ASM_DISKSTRING parameter. Here’s the description of V$ASM_DISKGROUP view from documentation:
V$ASM_DISKGROUP
displays one row for every ASM disk group discovered by the ASM instance on the node.
http://docs.oracle.com/cd/E18283_01/server.112/e17110/dynviews_1027.htm
I got explain plan of V$ASM_DISKGROUP to know which X$ table stand behind it and got – X$KFGRP
SQL> set autotrace on
SQL> select count(1) from v$asm_diskgroup;
COUNT(1)
———-
3
SQL> select name_kfgrp from x$kfgrp;
NAME_KFGRP
——————————
DATA
FLASH
OCR
SQL> select GRPNUM_KFDSK, NUMBER_KFDSK, STATE_KFDSK, ASMNAME_KFDSK, PATH_KFDSK from x$KFDSK;
Then I queried ASM_DISKGROUPS parameter :
SQL> show parameter disk
NAME TYPE VALUE
———————————— ———– ——————————
asm_diskgroups string OCR, DATA, FLASH
asm_diskstring string /dev/oracleasm/disks
No I will create a new tablespace under FLASH diskgroup, create a new table, change owner of the disk of FLASH diskgroup and make it #*disappear* from V$ASM_DISKGROUP view, and then return everything back
SQL> create tablespace new_tbs datafile ‘+FLASH’;
Tablespace created.
SQL> create table new_table (id number) tablespace new_tbs;
Table created.
SQL> insert into new_table values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from new_table;
ID
———-
1
I create a parameter file from spfile, change ASM_DISKGROUPS parameter to OCR,DATA (remove FLASH) and mount the ASM instance again using a parameter file with
ASM_DISKGROUPS=’OCR’,’DATA’ specified:
So DISK6 is member and as the disk is discovered by ASM instance, FLASH diskgroup is dismounted, but still there.
Let’s change the owner of the disk and check it again. But before checking the owner, let’s read it’s header by KFED:
[root@node1 disks]# kfed read DISK6
Now let’s start the instance and check V$ASM_DISKGROUP view:
Query X$KFGRP view:
SQL> select NAME_KFGRP from X$KFGRP;
NAME_KFGRP
——————————
DATA
OCR
SQL>
Switch to the database and check if you can query the table:
SQL> select * from new_table;
select * from new_table
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 8 – see DBWR trace file
ORA-01110: data file 8: ‘+FLASH/rac/datafile/new_tbs.257.837080939’
SQL>
Now shutdown the ASM instance, return the owner back and check V$ASM_DISKGROUP again:
[root@node1 disks]# chown -R oracle:dba DISK6
FLASH diskgroup appeared, however it’s not specified at ASM_DISKGROUPS parameter. Now mount the diskgroup and query the table again:
SQL> alter diskgroup flash mount;
Diskgroup altered.
SQL>
SQL> select * from new_table;
ID
———-
1
SQL>
This means that if you want to move the ASM instance to another host, it’s enough to specify ASM_DISKSTRING parameter, V$ASM_DISKGROUP will discover all diskgroups
February 12th, 2014 at 8:35 am
nice article
February 15th, 2015 at 11:26 pm
[…] V$ASM_DISKGROUP displays information from the header of ASM disks […]