Skip to content

How to Add Disks into ASM on Enterprise Linux 5

  • by
There is a potential risk when adding disks, that is, you could mistakenly erase the wrong disks for ASM candidates. So, our first step is to make sure the candidates are not used. In the following example, we are planning to add following 4 disks into ASM.
  • /dev/disk/asm/disk05
  • /dev/disk/asm/disk06
  • /dev/disk/asm/disk07
  • /dev/disk/asm/disk08
Make sure the candidates are not used by ASM currently. For Enterprise Linux 5, we should use oracleasm to check these 4 disks:
[root@primary01 ~]# oracleasm listdisks
DISK01
DISK02
DISK03
DISK04
[root@primary01 ~]# oracleasm querydisk -d /dev/disk/asm/disk05
Device "/dev/disk/asm/disk05" is not marked as an ASM disk
[root@primary01 ~]# oracleasm querydisk -d /dev/disk/asm/disk06
Device "/dev/disk/asm/disk06" is not marked as an ASM disk
[root@primary01 ~]# oracleasm querydisk -d /dev/disk/asm/disk07
Device "/dev/disk/asm/disk07" is not marked as an ASM disk
[root@primary01 ~]# oracleasm querydisk -d /dev/disk/asm/disk08
Device "/dev/disk/asm/disk08" is not marked as an ASM disk

If a disk has been registered as an ASM disk, it shows the message like this:
[root@primary01 ~]# oracleasm querydisk -d /dev/disk/asm/disk01
Device "/dev/disk/asm/disk01" is marked an ASM disk with the label "DISK01"

Erase the header of the disks by command "dd".
[root@primary01 ~]# dd if=/dev/zero of=/dev/disk/asm/disk05 bs=1024 count=4
4+0 records in
4+0 records out
4096 bytes (4.1 kB) copied, 0.082371 seconds, 49.7 kB/s
[root@primary01 ~]# dd if=/dev/zero of=/dev/disk/asm/disk06 bs=1024 count=4
4+0 records in
4+0 records out
4096 bytes (4.1 kB) copied, 0.058648 seconds, 69.8 kB/s
[root@primary01 ~]# dd if=/dev/zero of=/dev/disk/asm/disk07 bs=1024 count=4
4+0 records in
4+0 records out
4096 bytes (4.1 kB) copied, 0.042658 seconds, 96.0 kB/s
[root@primary01 ~]# dd if=/dev/zero of=/dev/disk/asm/disk08 bs=1024 count=4
4+0 records in
4+0 records out
4096 bytes (4.1 kB) copied, 0.035498 seconds, 115 kB/s

Create them as ASM disks and labeled as DISK05, DISK06, DISK07 and DISK08.
[root@primary01 ~]# oracleasm createdisk -v DISK05 /dev/disk/asm/disk05
Disk "DISK05" does not exist or is not instantiated
Writing disk header: done
Instantiating disk: done
[root@primary01 ~]# oracleasm createdisk -v DISK06 /dev/disk/asm/disk06
Disk "DISK06" does not exist or is not instantiated
Writing disk header: done
Instantiating disk: done
[root@primary01 ~]# oracleasm createdisk -v DISK07 /dev/disk/asm/disk07
Disk "DISK07" does not exist or is not instantiated
Writing disk header: done
Instantiating disk: done
[root@primary01 ~]# oracleasm createdisk -v DISK08 /dev/disk/asm/disk08
Disk "DISK08" does not exist or is not instantiated
Writing disk header: done
Instantiating disk: done

Check ASM disks by asmcmd.
[root@primary01 ~]# oracleasm listdisks
DISK01
DISK02
DISK03
DISK04
DISK05
DISK06
DISK07
DISK08
[oracle@primary01 ~]$ asmcmd
ASMCMD> lsdsk
Path
ORCL:DISK01
ORCL:DISK02
ORCL:DISK03
ORCL:DISK04
ASMCMD> lsdsk --candidate
Path
ORCL:DISK05
ORCL:DISK06
ORCL:DISK07
ORCL:DISK08

You must scan disks by oracleasm on the other nodes to refresh the status of all ASM disks.
[root@primary02 ~]# oracleasm listdisks
DISK01
DISK02
DISK03
DISK04
[root@primary02 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DISK07"
Instantiating disk "DISK06"
Instantiating disk "DISK05"
Instantiating disk "DISK08"
[root@primary02 ~]# oracleasm listdisks
DISK01
DISK02
DISK03
DISK04
DISK05
DISK06
DISK07
DISK08

Check ASM disks by sqlplus.
[oracle@primary01 ~]$ sqlplus / as sysasm
...
SQL> column diskgroup format a10;
SQL> column disk_name format a10;
SQL> column failgroup format a10;
SQL> column path format a12;
SQL> select name disk_name, path, mount_status, mode_status, state from v$asm_disk;

DISK_NAME  PATH         MOUNT_S MODE_ST STATE
---------- ------------ ------- ------- --------
           ORCL:DISK05  CLOSED  ONLINE  NORMAL
           ORCL:DISK06  CLOSED  ONLINE  NORMAL
           ORCL:DISK07  CLOSED  ONLINE  NORMAL
           ORCL:DISK08  CLOSED  ONLINE  NORMAL
DISK01     ORCL:DISK01  CACHED  ONLINE  NORMAL
DISK02     ORCL:DISK02  CACHED  ONLINE  NORMAL
DISK03     ORCL:DISK03  CACHED  ONLINE  NORMAL
DISK04     ORCL:DISK04  CACHED  ONLINE  NORMAL

8 rows selected.

Add 'ORCL:DISK05', 'ORCL:DISK06' into diskgroup 'DATA'
SQL> alter diskgroup data add disk 'ORCL:DISK05' name DISK05, 'ORCL:DISK06' name DISK06 rebalance power 5 nowait;

Diskgroup altered.

SQL> set linesize 150;
SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- --------------------------------------------
           1 REBAL RUN           5          5         12       1630        273           5

SQL> select * from v$asm_operation;

no rows selected

SQL> select name disk_name, path, mount_status, mode_status, state from v$asm_disk;

DISK_NAME  PATH         MOUNT_S MODE_ST STATE
---------- ------------ ------- ------- --------
           ORCL:DISK07  CLOSED  ONLINE  NORMAL
           ORCL:DISK08  CLOSED  ONLINE  NORMAL
DISK01     ORCL:DISK01  CACHED  ONLINE  NORMAL
DISK02     ORCL:DISK02  CACHED  ONLINE  NORMAL
DISK03     ORCL:DISK03  CACHED  ONLINE  NORMAL
DISK04     ORCL:DISK04  CACHED  ONLINE  NORMAL
DISK05     ORCL:DISK05  CACHED  ONLINE  NORMAL
DISK06     ORCL:DISK06  CACHED  ONLINE  NORMAL

8 rows selected.

SQL> select dg.name diskgroup, dk.name disk_name, dk.failgroup, dk.mount_status, dk.mode_status from v$asm_disk dk, v$asm_diskgroup dg where dk.group_number = dg.group_number;

DISKGROUP  DISK_NAME  FAILGROUP  MOUNT_S MODE_ST
---------- ---------- ---------- ------- -------
DATA       DISK01     DISK01     CACHED  ONLINE
DATA       DISK02     DISK02     CACHED  ONLINE
DATA       DISK03     DISK03     CACHED  ONLINE
DATA       DISK04     DISK04     CACHED  ONLINE
DATA       DISK05     DISK05     CACHED  ONLINE
DATA       DISK06     DISK06     CACHED  ONLINE

6 rows selected.

There are 6 disks in diskgroup DATA now.

Create a new diskgroup 'FRA' for fast recovery area.
SQL> create diskgroup fra normal redundancy disk 'ORCL:DISK07' name DISK07, 'ORCL:DISK08' name DISK08;

Diskgroup created.

SQL> select dg.name diskgroup, dk.name disk_name, dk.failgroup, dk.mount_status, dk.mode_status from v$asm_disk dk, v$asm_diskgroup dg where dk.group_number = dg.group_number;

DISKGROUP  DISK_NAME  FAILGROUP  MOUNT_S MODE_ST
---------- ---------- ---------- ------- -------
DATA       DISK01     DISK01     CACHED  ONLINE
DATA       DISK02     DISK02     CACHED  ONLINE
DATA       DISK03     DISK03     CACHED  ONLINE
DATA       DISK04     DISK04     CACHED  ONLINE
DATA       DISK05     DISK05     CACHED  ONLINE
DATA       DISK06     DISK06     CACHED  ONLINE
FRA        DISK07     DISK07     CACHED  ONLINE
FRA        DISK08     DISK08     CACHED  ONLINE

8 rows selected.

Finally, we can configure recovery destination to the new diskgroup +FRA.
[oracle@primary01 ~]$ sqlplus / as sysdba
...
SQL> show parameter db_recovery_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string
db_recovery_file_dest_size           big integer 0
SQL> alter system set db_recovery_file_dest_size=30G scope=both;

System altered.

SQL> show parameter db_recovery_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string
db_recovery_file_dest_size           big integer 30G
SQL> alter system set db_recovery_file_dest='+FRA' scope=both;

System altered.

SQL> show parameter db_recovery_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      +FRA
db_recovery_file_dest_size           big integer 30G

Leave a Reply

Your email address will not be published.