Friday, July 2, 2010

Migrating block devices using ASM instance to ASMLib

Metalink note 394955.1 describes how to migrate raw devices to ASMLib. Same theory is employed here to migrate block devices to ASM. This blog uses the block devices which were migrated from raw devices.

A block (or raw) device could be migrated to ASMLib and vise versa. But it is easier to migrate a device that was used in the ASMLib to use as a block (or raw) device than other way around. Reason is that when a disk is used to create a ASM instance either with ASMLib or directly using ASM itself, as in the case of block or raw devices, a disk tag or a disk marker "ORCLDISK" is written to the disk header among other things.
When a disk is used with ASMLib then in addition to a disk tag, a disk label is also added. This is missing when a raw or block devices are added to ASM with ASM itself (without the use of ASMLib). Disk label is the text used in the creatdisk command in the oracleasm.
/etc/init.d/oracleasm createdisk VOL1 /dev/sdc10
Creating Oracle ASM disk "DATA" [ OK ]
Here the text DATA is the disk label. This could be seen in v$asm_disk view in a ASM instance.
ASM instance using block devices
NAME       LABEL                PATH
---------- -------------------- ---------
DATA_0000 /dev/sdc8
FLASH_0000 /dev/sdc9
Label is missing.

ASM instance using ASMLib
NAME       LABEL                PATH
---------- -------------------- ------------
DATA01 DATA01 ORCL:DATA01
FLASH01 FLASH01 ORCL:FLASH01
Label is present.

Block or raw devices doesn't have any use for the label so ASMLib disks could be easily migrated to use raw or block devices. But ASMLib does look into the label and if it is not present it will not work.

To migrate block devices to ASMLib all that is required is to label them.

1. Set the new asm_diskstring to ORACL:* in the ASM instance
show parameter asm_diskstring
NAME TYPE VALUE
----------------- ----------- --------------------
asm_diskstring string /dev/sdc8, /dev/sdc9

alter system set asm_diskstring='ORCL:*' scope=spfile;
2.Shutdown the database instances and asm instances. If a disk is renamed while in use it could result in loss of data.

3. Install and configure ASMLib if already not done.

4. use ASMLib renamedisk to add a label to the disks. Tried to rename the disk as per above mentioned metalink note and received following warning.
/etc/init.d/oracleasm renamedisk /dev/sdc8 CLUSDATA
WARNING: Changing the label of an disk marked for ASM is a very dangerous
operation. If this is really what you mean to do, you must
ensure that all Oracle and ASM instances have ceased using
this disk. Otherwise, you may LOSE DATA.
If you really wish to change the label, rerun with the force-renamedisk command.
Renaming disk "/dev/sdc8" to "CLUSDATA": [FAILED]
which shows how serious the consequences are if rename was done while ASM is up.
Ok then try the force-renamedisk
/etc/init.d/oracleasm force-renamedisk /dev/sdc8 CLUSDATA
Renaming disk "/dev/sdc8" to "CLUSDATA": [ OK ]
/etc/init.d/oracleasm force-renamedisk /dev/sdc9 CLUSFLASH
Renaming disk "/dev/sdc9" to "CLUSFLASH": [ OK ]
This time no warning. Scan and list the disks
/etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
/etc/init.d/oracleasm listdisks
CLUSDATA
CLUSFLASH




5. Start the ASM instances. On the ASM alert log verify
cluster_database         = TRUE
instance_number = 1
asm_diskstring = "ORCL:*"
.
.
SQL> ALTER DISKGROUP ALL MOUNT
NOTE: cache registered group DATA number=1 incarn=0xe4da9dba
NOTE: cache began mount (first) of group DATA number=1 incarn=0xe4da9dba
NOTE: cache registered group FLASH number=2 incarn=0xe4da9dbb
NOTE: cache began mount (first) of group FLASH number=2 incarn=0xe4da9dbb
NOTE:Loaded lib: /opt/oracle/extapi/64/asm/orcl/1/libasm.so
NOTE: Assigning number (1,0) to disk (ORCL:CLUSDATA)
NOTE: Assigning number (2,0) to disk (ORCL:CLUSFLASH)
NOTE: start heartbeating (grp 1)
kfdp_query(): 4
kfdp_queryBg(): 4
NOTE: cache opening disk 0 of grp 1: DATA_0000 label:CLUSDATA
NOTE: F1X0 found on disk 0 fcn 0.0
NOTE: cache mounting (first) group 1/0xE4DA9DBA (DATA)
* allocate domain 1, invalid = TRUE
NOTE: attached to recovery domain 1
NOTE: cache recovered group 1 to fcn 0.9731
NOTE: LGWR attempting to mount thread 1 for diskgroup 1
NOTE: LGWR mounted thread 1 for disk group 1
NOTE: opening chunk 1 at fcn 0.9731 ABA
NOTE: seq=17 blk=1358
NOTE: cache mounting group 1/0xE4DA9DBA (DATA) succeeded
NOTE: cache ending mount (success) of group DATA number=1 incarn=0xe4da9dba
NOTE: start heartbeating (grp 2)
kfdp_query(): 6
kfdp_queryBg(): 6
NOTE: cache opening disk 0 of grp 2: FLASH_0000 label:CLUSFLASH
NOTE: F1X0 found on disk 0 fcn 0.0
NOTE: cache mounting (first) group 2/0xE4DA9DBB (FLASH)
* allocate domain 2, invalid = TRUE
NOTE: attached to recovery domain 2
NOTE: cache recovered group 2 to fcn 0.4360
NOTE: LGWR attempting to mount thread 1 for diskgroup 2
NOTE: LGWR mounted thread 1 for disk group 2
NOTE: opening chunk 1 at fcn 0.4360 ABA
NOTE: seq=17 blk=248
NOTE: cache mounting group 2/0xE4DA9DBB (FLASH) succeeded
NOTE: cache ending mount (success) of group FLASH number=2 incarn=0xe4da9dbb
5. Label could be seen in the v$asm_disk view
NAME       LABEL      PATH
---------- ---------- --------------
DATA_0000 CLUSDATA ORCL:CLUSDATA
FLASH_0000 CLUSFLASH ORCL:CLUSFLASH

Related Posts
Migrating OCR to ASM in 11gR2 Clusterware
Migrating Voting Disk to ASM in 11gR2 Clusterware
Moving OCR, Vote and ASM from Raw Devices to Block Devices
Moving ASMLib disk to block devices (Non-ASMLib) in 11gR2 Standalone
Moving ASMLib disk to block devices (Non-ASMLib) in 11gR1 RAC
Moving ASMLib disk to block devices (Non-ASMLib) in 11gR2 RAC