Check ASM disk status and fix problems

Check ASM disk status

Check ASM disk status 

SQL> select    g.name disk_grp, o.group_number, operation , est_minutes from gv$asm_operation o,    gv$asm_diskgroup g
         where g.group_number = o.group_number and o.inst_id = g.inst_id;

no rows selected --> No rebalance operation in progress 

SQL> select d.inst_id, dg.name dg_name,  dg.state dg_state,    dg.type,d.name, d.DISK_NUMBER dsk_no, d.MOUNT_STATUS, d.HEADER_STATUS, d.MODE_STATUS,
             d.STATE, d. PATH, d.FAILGROUP  FROM GV$ASM_DISK d,  gv$asm_diskgroup dg
          where dg.group_number(+)=d.group_number and d.inst_id = dg.inst_id order by d.inst_id, d.group_number;
   INST_ID DG_NAME    DG_STATE     TYPE    NAME              DSK_NO MOUNT_S HEADER_STATU MODE_ST STATE    PATH                     FAILGROUP
---------- ---------- ---------- ------ -------------------- ------- ------- ------------ ------- -------- ---------------------------------------- ---------------
     1 OCR          MOUNTED     NORMAL OCR_0000           0 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdf1            OCR_0000
     1 OCR          MOUNTED     NORMAL OCR_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdh1            OCR_0002
     1 OCR          MOUNTED     NORMAL OCR_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdg1            OCR_0001
     1 FRA          MOUNTED     EXTERN FRA_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk_fra2                FRA_0002
     1 FRA          MOUNTED     EXTERN FRA_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk_fra1                FRA_0001
     1 DATA       MOUNTED     NORMAL DATA_0001           1 CACHED  CANDIDATE      ONLINE  NORMAL   ORCL:DATA2                    DATA_0001
     1 DATA       MOUNTED     NORMAL DATA_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdd1            DATA_0002
     1 DATA       MOUNTED     NORMAL DATA_0003           3 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sde1            DATA_0003
     1 SSD          MOUNTED     NORMAL SSD_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd3                SSD_0002
     1 SSD          MOUNTED     NORMAL SSD_0000           0 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd1                SSD_0000
     1 SSD          MOUNTED     NORMAL SSD_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd2                SSD_0001
     2 OCR          MOUNTED     NORMAL OCR_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdh1            OCR_0002
     2 OCR          MOUNTED     NORMAL OCR_0000           0 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdf1            OCR_0000
     2 OCR          MOUNTED     NORMAL OCR_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdg1            OCR_0001
     2 FRA          MOUNTED     EXTERN FRA_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk_fra2                FRA_0002
     2 FRA          MOUNTED     EXTERN FRA_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk_fra1                FRA_0001
     2 DATA       MOUNTED     NORMAL DATA_0001           1 CACHED  CANDIDATE      ONLINE  NORMAL   /dev/asmdisk1_udev_sdc1            DATA_0001
     2 DATA       MOUNTED     NORMAL DATA_0003           3 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sde1            DATA_0003
     2 DATA       MOUNTED     NORMAL DATA_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdd1            DATA_0002
     2 SSD          MOUNTED     NORMAL SSD_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd3                SSD_0002
     2 SSD          MOUNTED     NORMAL SSD_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd2                SSD_0001
     2 SSD          MOUNTED     NORMAL SSD_0000           0 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd1                SSD_0000
     2 ASMLIB_DG  MOUNTED     NORMAL ASMLIB_DG_0002           2 CACHED  CANDIDATE      ONLINE  NORMAL   /dev/oracleasm/disks/ASMLIB_DISK3        ASMLIB_DG_0002
     2 ASMLIB_DG  MOUNTED     NORMAL ASMLIB_DG_0001           1 CACHED  CANDIDATE      ONLINE  NORMAL   /dev/oracleasm/disks/ASMLIB_DISK2        ASMLIB_DG_0001
     2 ASMLIB_DG  MOUNTED     NORMAL ASMLIB_DG_0000           0 CACHED  CANDIDATE      ONLINE  NORMAL   /dev/oracleasm/disks/ASMLIB_DISK1        ASMLIB_DG_0000
     3 OCR          MOUNTED     NORMAL OCR_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdg1            OCR_0001
     3 OCR          MOUNTED     NORMAL OCR_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdh1            OCR_0002
     3 OCR          MOUNTED     NORMAL OCR_0000           0 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdf1            OCR_0000
     3 FRA          MOUNTED     EXTERN FRA_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk_fra1                FRA_0001
     3 FRA          MOUNTED     EXTERN FRA_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk_fra2                FRA_0002
     3 DATA       MOUNTED     NORMAL DATA_0003           3 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sde1            DATA_0003
     3 DATA       MOUNTED     NORMAL DATA_0001           1 CACHED  CANDIDATE      ONLINE  NORMAL   /dev/asmdisk1_udev_sdc1            DATA_0001
     3 DATA       MOUNTED     NORMAL DATA_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk1_udev_sdd1            DATA_0002
     3 SSD          MOUNTED     NORMAL SSD_0002           2 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd3                SSD_0002
     3 SSD          MOUNTED     NORMAL SSD_0000           0 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd1                SSD_0000
     3 SSD          MOUNTED     NORMAL SSD_0001           1 CACHED  MEMBER      ONLINE  NORMAL   /dev/asmdisk8_ssd2                SSD_0001
--> Here we have some problems 
    1. ASMLIB_DG is only mounted on Node 2 - disks status CANDIDATE 
    2. Disk DATA_0001 is handled by ASMLIB at Node 1 but is using UDEV at Node2 , Node 3

Create/Drop Diskgroup

Overview using force option with mount,dismount drop and create DG

  Mount force
  The force option becomes a must when a disk group mount reports missing disks. This is one of the cases when 
  it's safe and required to use the force option. Provided we are not missing too many disks, the mount force 
  should succeed. Basically, at least one partner disk - from every disk partnership in the disk group - must 
  be available.

  Create Diskgroup force 
  If the disk to be added to a disk group is not CANDIDATE, PROVISIONED or FORMER, I have to specify force next 
  to the disk name. This will destroy the data on that specified disk(s).

  Forcing disk group drop
  To drop a disk group I have to mount it first. If I cannot mount a disk group, but must drop it, I can use the 
  force option of the DROP DISKGROUP statement, like this:
  SQL> drop diskgroup PLAY force including contents;

  Forcing disk group dismount
  ASM does not allow a disk group to be dismounted if it's still being accessed. But I can force the disk group 
  dismount even if some files in the disk group are open. Here is an example:
  SQL> alter diskgroup PLAY dismount;
  alter diskgroup PLAY dismount
  *
  ERROR at line 1:
  ORA-15032: not all alterations performed
  ORA-15027: active use of diskgroup "PLAY" precludes its dismount

  Note that the forced disk group dismount will cause all datafiles in that database to go offline, which means they 
  will need recovery (and restore if I drop disk group PLAY)

  For details please read

Using kfed/dd to repair ASM disk header corruption

Overview

 

  • Note – Don’t run these commands on your production system as you can easily corrupt your data
  • In ASM versions 11.1.0.7 and later, the ASM disk header block is backed up in the second last ASM metadata block in the allocation unit 1.

Kfed parameters

  • aun – Allocation Unit (AU) number to read from. Default is AU0, or the very beginning of the ASM disk.
  • aus – AU size. Default is 1048576 (1MB). Specify the aus when reading from a disk group with non-default AU size.
  • blkn – block number to read. Default is block 0, or the very first block of the AU.
  • dev – ASM disk or device name. Note that the keyword dev can be omitted, but the ASM disk name is mandatory.