Online ASM Disk Migration of Oracle 11g RAC  (Demo on Oracle VM VirtualBox 5.0)

On the host operating system(Windows 7 as my environment), switch to the command line interface:

cd F:\VirtualBox
F:
F:\VirtualBox> VBoxManage createhd --filename "F:\VirtualBox VMs\asm1B.vdi" --size 5120 --format VDI --variant Fixed
F:\VirtualBox> VBoxManage createhd --filename "F:\VirtualBox VMs\asm2B.vdi" --size 5120 --format VDI --variant Fixed
F:\VirtualBox> VBoxManage createhd --filename "F:\VirtualBox VMs\asm3B.vdi" --size 5120 --format VDI --variant Fixed
F:\VirtualBox> VBoxManage createhd --filename "F:\VirtualBox VMs\asm4B.vdi" --size 5120 --format VDI --variant Fixed

Connect the four newly created hard disks to the VM - RAC1.
F:\VirtualBox> VBoxManage storageattach RAC1 --storagectl "SATA" --port 5 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm1B.vdi" --mtype shareable
F:\VirtualBox> VBoxManage storageattach RAC1 --storagectl "SATA" --port 6 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm2B.vdi" --mtype shareable
F:\VirtualBox> VBoxManage storageattach RAC1 --storagectl "SATA" --port 7 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm3B.vdi" --mtype shareable
F:\VirtualBox> VBoxManage storageattach RAC1 --storagectl "SATA" --port 8 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm4B.vdi" --mtype shareable

Connect the four newly created hard disks to the VM - RAC2.
F:\VirtualBox> VBoxManage storageattach RAC2 --storagectl "SATA" --port 5 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm1B.vdi" --mtype shareable
F:\VirtualBox> VBoxManage storageattach RAC2 --storagectl "SATA" --port 6 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm2B.vdi" --mtype shareable
F:\VirtualBox> VBoxManage storageattach RAC2 --storagectl "SATA" --port 7 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm3B.vdi" --mtype shareable
F:\VirtualBox> VBoxManage storageattach RAC2 --storagectl "SATA" --port 8 --device 0 --type hdd --medium "F:\VirtualBox VMs\asm4B.vdi" --mtype shareable

Make the four hark disks shareable.
F:\VirtualBox> VBoxManage modifyhd "F:\VirtualBox VMs\asm1B.vdi" --type shareable
F:\VirtualBox> VBoxManage modifyhd "F:\VirtualBox VMs\asm2B.vdi" --type shareable
F:\VirtualBox> VBoxManage modifyhd "F:\VirtualBox VMs\asm3B.vdi" --type shareable
F:\VirtualBox> VBoxManage modifyhd "F:\VirtualBox VMs\asm4B.vdi" --type shareable

Start the "RAC1" and "RAC2" VM by clicking the "Start" button on the toolbar:

[root@rac1 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8,   0 Jun 15 16:21 /dev/sda
brw-r----- 1 root disk 8,   1 Jun 16  2016 /dev/sda1
brw-r----- 1 root disk 8,   2 Jun 15 16:21 /dev/sda2
brw-r----- 1 root disk 8,  16 Jun 15 16:21 /dev/sdb
brw-r----- 1 root disk 8,  17 Jun 16  2016 /dev/sdb1
brw-r----- 1 root disk 8,  32 Jun 15 16:21 /dev/sdc
brw-r----- 1 root disk 8,  33 Jun 16  2016 /dev/sdc1
brw-r----- 1 root disk 8,  48 Jun 15 16:21 /dev/sdd
brw-r----- 1 root disk 8,  49 Jun 16  2016 /dev/sdd1
brw-r----- 1 root disk 8,  64 Jun 15 16:21 /dev/sde
brw-r----- 1 root disk 8,  65 Jun 16  2016 /dev/sde1
brw-r----- 1 root disk 8,  80 Jun 15 16:21 /dev/sdf

brw-r----- 1 root disk 8,  96 Jun 15 16:21 /dev/sdg
brw-r----- 1 root disk 8, 112 Jun 15 16:21 /dev/sdh
brw-r----- 1 root disk 8, 128 Jun 15 16:21 /dev/sdi

Use the "fdisk" command to partition the disks sdf to sdi.   (PS. repeat fdisk command from sdf to sdi)

[root@rac1 ~]# fdisk /dev/sdf
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.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652

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 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


Verify the results:

[root@rac1 ~]# ll /dev/sd*1
brw-r----- 1 root disk 8,   1 Jun 16  2016 /dev/sda1
brw-r----- 1 root disk 8,  17 Jun 16  2016 /dev/sdb1
brw-r----- 1 root disk 8,  33 Jun 16  2016 /dev/sdc1
brw-r----- 1 root disk 8,  49 Jun 16  2016 /dev/sdd1
brw-r----- 1 root disk 8,  65 Jun 16  2016 /dev/sde1
brw-r----- 1 root disk 8,  81 Jun 15 16:27 /dev/sdf1

brw-r----- 1 root disk 8,  97 Jun 15 16:29 /dev/sdg1
brw-r----- 1 root disk 8, 113 Jun 15 16:29 /dev/sdh1
brw-r----- 1 root disk 8, 129 Jun 15 16:30 /dev/sdi1

[root@rac1 ~]# oracleasm createdisk DISK1B /dev/sdf1
Writing disk header: done
Instantiating disk: done
[root@rac1 ~]# oracleasm createdisk DISK2B /dev/sdg1
Writing disk header: done
Instantiating disk: done
[root@rac1 ~]# oracleasm createdisk DISK3B /dev/sdh1
Writing disk header: done
Instantiating disk: done
[root@rac1 ~]# oracleasm createdisk DISK4B /dev/sdi1
Writing disk header: done
Instantiating disk: done

[root@rac1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...

[root@rac1 ~]# oracleasm listdisks
DISK1
DISK1B
DISK2
DISK2B
DISK3
DISK3B
DISK4
DISK4B

Add the four newly created disks to the DISKGROUP DATA:

SQL> ALTER DISKGROUP DATA ADD DISK
'ORCL:DISK1B' NAME DISK1B,
'ORCL:DISK2B' NAME DISK2B,
'ORCL:DISK3B' NAME DISK3B,
'ORCL:DISK4B' NAME DISK4B
REBALANCE POWER 5;


SQL> SELECT * FROM V$ASM_OPERATION;

SQL> SELECT GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,MODE_STATUS,STATE,NAME

FROM V$ASM_DISK ORDER BY 2;

Drop the four original disks of the DISK GROUP DATA as follow:
ALTER DISKGROUP DATA DROP DISK
DISK1, DISK2, DISK3, DISK4
REBALANCE POWER 5;

 


 



[root@rac1 disks]# oracleasm deletedisk DISK1
Clearing disk header: done
Dropping disk: done
[root@rac1 disks]# oracleasm deletedisk DISK2
Clearing disk header: done
Dropping disk: done
[root@rac1 disks]# oracleasm deletedisk DISK3
Clearing disk header: done
Dropping disk: done
[root@rac1 disks]# oracleasm deletedisk DISK4
Clearing disk header: done
Dropping disk: done

[root@rac1 disks]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...

[root@rac1 disks]# oracleasm listdisks
DISK1B
DISK2B
DISK3B
DISK4B

Verify that the original disks were cleared as follows:

PS.

Please refer to http://danbrother.pixnet.net/blog/post/196645281
for the documentation of Replacing Voting Disk and OCR Diskgroup on Oracle 11gR2 / ASM

 



 

 

 

 

 

 

 

 

arrow
arrow

    DanBrother 發表在 痞客邦 留言(0) 人氣()