Thursday 18 February 2016

Add new multipath disk to ASM Diskgroup

A Multipath disk provide failover by using redundant physical path components,  eliminating a single point of failure with the Storage Area Network (SAN). Multipathing is a software technology implemented at the operating system device driver level.
With ASM, you can ensure the discovery of a multipath disk by setting the value of the initialization parameter ASM_DISKSTRING equal to the name of the pseudo device that represents the multipath disk.
Below steps can be followed to add a new disk to ASM Disk Group.
STEP 1) CHECK CURRENT DISKS


  
SQL> selectGROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,HEADER_
STATUS,MODE_STATUS,STATE,VOTING_FILE,name,pathfrom from v$asm_disk;


GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATUS MODE_ST STATE 
———— ———– ——- ———— ——- ——– – ————– ———————————
 MEMBER ONLINE NORMAL N ARC_LOG_0000 /dev/oracleasm/disks/ARC_LOG01
 MEMBER ONLINE NORMAL Y OCR_VOTE_0000 /dev/oracleasm/disks/OCR_VOTE01
 MEMBER ONLINE NORMAL N DB_DATA_0004 /dev/oracleasm/disks/DB_DATA05
 MEMBER ONLINE NORMAL N DB_DATA_0003 /dev/oracleasm/disks/DB_DATA04
 MEMBER ONLINE NORMAL N DB_DATA_0002 /dev/oracleasm/disks/DB_DATA03
 MEMBER ONLINE NORMAL N DB_DATA_0001 /dev/oracleasm/disks/DB_DATA02
 MEMBER ONLINE NORMAL N DB_DATA_0000 /dev/oracleasm/disks/DB_DATA01
 MEMBER ONLINE NORMAL N DB_DATA_0005 /dev/oracleasm/disks/DB_DATA06
rows selected.


STEP 2) CHECK ASM TO PHYSICAL DISK MAPPING
If you have not documented earlier which ASM disk is mapped to which physical disk and what all free disks you have in your server, your need t firs find out this information.
Use asm querydisk command first with every ASM disk name:

# /etc/init.d/oracleasm querydisk -d DB_DATA01
Disk “DB_DATA01″ is a valid ASM disk on device /dev/sdl[8,176]
# /etc/init.d/oracleasm querydisk -d DB_DATA02
Disk “DB_DATA02″ is a valid ASM disk on device /dev/sdm[8,192]
# /etc/init.d/oracleasm querydisk -d DB_DATA03
Disk “DB_DATA03″ is a valid ASM disk on device /dev/sdn[8,208]
# /etc/init.d/oracleasm querydisk -d DB_DATA04
Disk “DB_DATA04″ is a valid ASM disk on device /dev/sdo[8,224]
# /etc/init.d/oracleasm querydisk -d DB_DATA05
Disk “DB_DATA05″ is a valid ASM disk on device /dev/sdp[8,240]
# /etc/init.d/oracleasm querydisk -d DB_DATA06
Disk “DB_DATA06″ is a valid ASM disk on device /dev/sdq[65,0]
# /etc/init.d/oracleasm querydisk -d ARC_LOG01
Disk “ARC_LOG01″ is a valid ASM disk on device /dev/sdr[65,16]
# /etc/init.d/oracleasm querydisk -d OCR_VOTE01
Disk “OCR_VOTE01″ is a valid ASM disk on device /dev/sdb1[8,17]

Now use multipath -ll to check corresponding multipath disk and what all disks are free in your server.

# multipath -ll
mpath7 (360060e8006d8e7000000d8e700001000) dm-17 HP,OPEN-V
[size=50G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 3:0:0:0 sdb 8:16 [active][ready]
\_ 4:0:0:0 sdv 65:80 [active][ready]
mpath18 (360060e8006d8e7000000d8e700000001) dm-8 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:11 sdag 66:0 [active][ready]
\_ 3:0:0:11 sdm 8:192 [active][ready]
mpath19 (360060e8006d8e7000000d8e700000002) dm-9 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:12 sdah 66:16 [active][ready]
\_ 3:0:0:12 sdn 8:208 [active][ready]
mpath20 (360060e8006d8e7000000d8e700000003) dm-10 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:13 sdai 66:32 [active][ready]
\_ 3:0:0:13 sdo 8:224 [active][ready]
mpath21 (360060e8006d8e7000000d8e700000004) dm-11 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:14 sdaj 66:48 [active][ready]
\_ 3:0:0:14 sdp 8:240 [active][ready]
mpath22 (360060e8006d8e7000000d8e700000005) dm-12 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:15 sdak 66:64 [active][ready]
\_ 3:0:0:15 sdq 65:0 [active][ready]
mpath23 (360060e8006d8e7000000d8e700000006) dm-13 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:16 sdal 66:80 [active][ready]
\_ 3:0:0:16 sdr 65:16 [active][ready]
mpath24 (360060e8006d8e7000000d8e700000007) dm-14 HP,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 4:0:0:17 sdam 66:96 [active][ready]
\_ 3:0:0:17 sds 65:32 [active][ready]

Looking at the above two outputs we can find out which ASM disk is attached to what physical disk
For example DB_DATA02 (on /dev/sdm) is attached to Physical multi disk path mpath18.
mpath24 can be seen as free physical disk which is not linked to any ASM disk yet.

STEP 3) PARTITION THE DISK
We will use the free disk /dev/mapper/mpath24

# fdisk -l /dev/mapper/mpath24
Disk /dev/mapper/mpath24: 107.3 GB, 107374510080 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/mapper/mpath24 doesn’t contain a valid partition table

1
# fdisk /dev/mapper/mpath24
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.
The number of cylinders for this disk is set to 13054.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): n
Command action
e extended
primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-209715839, default 63): 2048
Last sector or +size or +sizeM or +sizeK (2048-209715839, default 209715839):
Using default value 209715839
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


# /sbin/partprobe


# fdisk -l /dev/mapper/mpath24
Disk /dev/mapper/mpath24: 107.3 GB, 107374510080 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/mapper/mpath24p1 1 13055 104856896 83 Linux


# kpartx -a /dev/mapper/mpath24


STEP 4) CREATE ASM DISK

# /etc/init.d/oracleasm createdisk ARC_LOG02 /dev/mapper/mpath24p1
Marking disk “ARC_LOG02″ as an ASM disk: [ OK ]

Run below command on all database nodes (if using RAC):

# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]


# /etc/init.d/oracleasm listdisks
ARC_LOG01
ARC_LOG02
DB_DATA01
DB_DATA02
DB_DATA03
DB_DATA04
DB_DATA05
DB_DATA06
OCR_VOTE01
The new disk should be visible from all database nodes now.
Now we have ASM disk ready to be added to ASM Disk Group

STEP 5) ADD ASM DISK TO DISKGROUP
Check Current Status >

SQL> set lines 132
SQL> col name format a14
SQL> col PATH format a33
SQL> select GROUP_NUMBER,NAME,STATE,TYPE,TOTAL_MB,FREE_MB,VOTING_FILES fromv$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB V
———— ————– ———– —— ———- ———- -
1 ARC_LOG MOUNTED EXTERN 102400 101705 N
2 DB_DATA MOUNTED EXTERN 614400 167345 N
3 OCR_VOTE MOUNTED EXTERN 51199 50803 Y
SQL> select GROUP_NUMBER,DISK_NUMBER,STATE,name,path,MOUNT_STATUS,HEADER_STATUS fromv$asm_disk;
GROUP_NUMBER DISK_NUMBER STATE NAME PATH MOUNT_S HEADER_STATU
———— ———– ——– ————– ——————————— ——- ————
0 0 NORMAL /dev/oracleasm/disks/ARC_LOG02 CLOSED PROVISIONED
2 0 NORMAL ARC_LOG_0000 /dev/oracleasm/disks/ARC_LOG01 CACHED MEMBER
1 0 NORMAL OCR_VOTE_0000 /dev/oracleasm/disks/OCR_VOTE01 CACHED MEMBER
3 4 NORMAL DB_DATA_0004 /dev/oracleasm/disks/DB_DATA05 CACHED MEMBER
3 3 NORMAL DB_DATA_0003 /dev/oracleasm/disks/DB_DATA04 CACHED MEMBER
3 2 NORMAL DB_DATA_0002 /dev/oracleasm/disks/DB_DATA03 CACHED MEMBER
3 1 NORMAL DB_DATA_0001 /dev/oracleasm/disks/DB_DATA02 CACHED MEMBER
3 0 NORMAL DB_DATA_0000 /dev/oracleasm/disks/DB_DATA01 CACHED MEMBER
3 5 NORMAL DB_DATA_0005 /dev/oracleasm/disks/DB_DATA06 CACHED MEMBER
rows selected.

As you can see that the new disk’s status is showing as ‘PROVISIONED’.
NOW ADD NEW DISK :
1
SQL> ALTER DISKGROUP ARC_LOG ADD DISK ‘/dev/oracleasm/disks/ARC_LOG02′ NOFORCE ;
You can verify the rebalancing operation by below SQL command.

SQL> select * from v$asm_operation ;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ERROR_CODE
———— —– —- ———- ———- ———- ———- ———————————-
1 REBAL RUN 1 1 5046 5631 4780 0


STEP 6) CHECK NEW STATUS

SQL> select GROUP_NUMBER,NAME,STATE,TYPE,TOTAL_MB,FREE_MB,VOTING_FILES fromv$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB V
———— ————– ———– —— ———- ———- -
1 ARC_LOG MOUNTED EXTERN 204799 192963 N
2 DB_DATA MOUNTED EXTERN 614400 145525 N
3 OCR_VOTE MOUNTED EXTERN 51199 50803 Y
SQL> select GROUP_NUMBER,DISK_NUMBER,STATE,name,path,MOUNT_STATUS,HEADER_STATUS fromv$asm_disk;
GROUP_NUMBER DISK_NUMBER STATE NAME PATH MOUNT_S HEADER_STATU
———— ———– ——– ————– ——————————— ——- ————
2 0 NORMAL ARC_LOG_0000 /dev/oracleasm/disks/ARC_LOG01 CACHED MEMBER
1 0 NORMAL OCR_VOTE_0000 /dev/oracleasm/disks/OCR_VOTE01 CACHED MEMBER
3 4 NORMAL DB_DATA_0004 /dev/oracleasm/disks/DB_DATA05 CACHED MEMBER
3 3 NORMAL DB_DATA_0003 /dev/oracleasm/disks/DB_DATA04 CACHED MEMBER
3 2 NORMAL DB_DATA_0002 /dev/oracleasm/disks/DB_DATA03 CACHED MEMBER
3 1 NORMAL DB_DATA_0001 /dev/oracleasm/disks/DB_DATA02 CACHED MEMBER
3 0 NORMAL DB_DATA_0000 /dev/oracleasm/disks/DB_DATA01 CACHED MEMBER
3 5 NORMAL DB_DATA_0005 /dev/oracleasm/disks/DB_DATA06 CACHED MEMBER
2 1 NORMAL ARC_LOG_0001 /dev/oracleasm/disks/ARC_LOG02 CACHED MEMBER
rows selected.

No comments:

Post a Comment