Monday, July 2, 2018

ASM Disk not Accessible and not Appearing in V$ASM_DISK

If you are using ASMLib for your ASM storage and it is working perfectly fine; then, after adding a new ASM Disk you suddenly realize that although new disk is being listed by “oracleasm listdisks” command, it is still not appearing in V$ASM_DISK view. As a result, you are not able to add this new disk in your diskgroup because disk is not accessible to ASM instance. One reason of this could be that ASMLib configuration is not as it should be. Reasons could be: OS patching, oracleasm kernel driver update etc.

Following is a real world example of this scenario when I was not able to see a disk in V$ASM_DISK after I added a new disk using ASMLib.
[root@mydbserver ~]# oracleasm createdisk DATA05 /dev/sdn1
Writing disk header: done
Instantiating disk: done
[root@mydbserver ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@mydbserver ~]# oracleasm listdisks
DATA01
DATA02
DATA03
DATA04
DATA05

Querying V$ASM_DISK

[root@mydbserver ~]# su - grid
[grid@mydbserver ~]$ sqlplus

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 2 11:12:04 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter user-name: sys as sysasm
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option

SQL> select os_mb,name,header_status from v$asm_disk;

     OS_MB NAME                           HEADER_STATU
---------- ------------------------------ ------------
    262138 DATA01                         MEMBER
    262138 DATA02                         MEMBER
    262138 DATA03                         MEMBER
    262138 DATA04                         MEMBER

As you can see DATA05 is not accessible to ASM instance.


Checking ASM disks permissions

When I checked ASM disks permissions, it became clear that something was wrong with ASMLib. You can see permissions difference between old disks and the new one that I just added.
[root@mydbserver ~]# cd /dev/oracleasm/disks

[root@mydbserver disks]# ls -l
total 0
brw-rw---- 1 root root 8, 145 Dec  4  2017 DATA01
brw-rw---- 1 root root 8, 161 Dec  4  2017 DATA02
brw-rw---- 1 root root 8, 177 Dec  4  2017 DATA03
brw-rw---- 1 root root 8,  49 Dec  4  2017 DATA04
brw------- 1 root root 8, 209 Jul  2 11:11 DATA05


Checking and Re-setting ASM configuration


When I checked ASM configuration, it was evident that ASM configuration has gone missing. You can see that ORACLEASM_UID and ORACLEASM_GID are missing.
[root@mydbserver disks]# /usr/sbin/oracleasm configure
ORACLEASM_ENABLED=false
ORACLEASM_UID=
ORACLEASM_GID=
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_SCAN_DIRECTORIES=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"


Since configuration was missing, I needed to re-configure ASMLib. Following is the procedure to do this. Highlighted in red are the input values to the configuration command.
[root@mydbserver disks]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]

[root@mydbserver disks]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@mydbserver disks]# oracleasm listdisks
DATA01
DATA02
DATA03
DATA04
DATA05

[root@mydbserver disks]# /usr/sbin/oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=grid
ORACLEASM_GID=asmadmin
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_SCAN_DIRECTORIES=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"


After the re-configuration, we can check the disks permissions once again that are now correctly set for DATA05 disk.
[root@mydbserver ~]# cd /dev/oracleasm/disks

[root@mydbserver disks]# ls -l
total 0
brw-rw---- 1 grid asmadmin 8, 145 Dec  4  2017 DATA01
brw-rw---- 1 grid asmadmin 8, 161 Dec  4  2017 DATA02
brw-rw---- 1 grid asmadmin 8, 177 Dec  4  2017 DATA03
brw-rw---- 1 grid asmadmin 8,  49 Dec  4  2017 DATA04
brw-rw---- 1 grid asmadmin 8, 209 Jul  2 11:11 DATA05


Disk is now also visible in V$ASM_DISK view.
SQL> select path,os_mb,state,header_status,name from v$asm_disk;

PATH                              OS_MB STATE       HEADER_STATU NAME
-------------------- ---------- -------- ------------ -----------------------------------
ORCL:DATA05             262138 NORMAL   PROVISIONED
ORCL:DATA01              262138 NORMAL   MEMBER              DATA01
ORCL:DATA02              262138 NORMAL   MEMBER              DATA02
ORCL:DATA03              262138 NORMAL   MEMBER              DATA03
ORCL:DATA04              262138 NORMAL   MEMBER              DATA04

Adding disk to the ASM diskgroup

Now this disk can either be added to an existing diskgroup, or a new diskgroup can be created using this disk.
SQL> ALTER DISKGROUP DATA ADD DISK ‘ORCL:DATA05’;

2 comments:


  1. i have my single instance database up and running with ASM.

    i want to convert this database to RAC ...


    i have shared same disks on node2

    when i do fdisk -l

    i can see all those disks on node2

    root:oracleasm configure -i
    root:/usr/sbin/oracleasm init


    oracleasm listdisks is not showing my disks on node2 ......

    can anyone advise ?

    ReplyDelete
    Replies
    1. Did you execute "oracleasm scandisks" ?
      Do you see disks listed under "/dev/oracleasm/disks" directory? The ownership should be same as I mentioned above in the article.

      Delete

Popular Posts - All Times