Create the Target Virtual Machine
The first step is to create a virtual machine. This virtual machine should have the same OS and kernel version. All pre-installation tasks like creating OS users and groups, setting recommended kernel parameters, etc. need to done. It is therefore better to create the target VM by cloning it from the source.
Go to Compute -> Virtual Machines and find the source VM. Click on the VM to go to the detail page. Click on the Snapshots tab and highlight one of the snapshots you would like to use to clone the VM.
After the VM is created, it will be in the "Down" status. We would want to disconnect the network so that there is no IP address clash when we turn the VM on. Go to the VM details page and click on the Network tab and edit the network to open the following window. Select the Down radio button to disable the network.
Next, we start the VM by clicking on the Run button.
As the network is down, we will click on the Console button to open the console. Log in as root and assign a new IP address to this VM and restart the network service on the VM.
Now we go back to the "Edit Network Interface" screen and enable the network interface by selecting the Up radio button. Check that you are able to connect to this VM from other machines on the network.
Snapshot Source Volumes on the FlashArray
Take a snapshot of the source volumes.
SUFFIX=`date +%Y-%m-%d-%H%M%S`
FLASH_ARRAY=10.21.184.113
ssh pureuser@${FLASH_ARRAY} purevol snap --suffix SNAP-$SUFFIX oracle-lvm-prod-002-data-01 oracle-lvm-prod-002-fra-01 oracle-lvm-prod-002-redo-01
Snapshot the volume that contains the Oracle Homes. This is a one time step that is needed when we are setting up a new clone.
ssh pureuser@${FLASH_ARRAY} purevol snap --suffix SNAP-$SUFFIX oracle-lvm-prod-002-orasoft
Copy Snapshot Volumes to Target Volumes
Copy them to the corresponding target volumes.
ssh pureuser@${FLASH_ARRAY} purevol copy oracle-lvm-prod-002-data-01.SNAP-$SUFFIX oracle-lvm-dev-002-data-01
ssh pureuser@${FLASH_ARRAY} purevol copy oracle-lvm-prod-002-fra-01.SNAP-$SUFFIX oracle-lvm-dev-002-fra-01
ssh pureuser@${FLASH_ARRAY} purevol copy oracle-lvm-prod-002-redo-01.SNAP-$SUFFIX oracle-lvm-dev-002-redo-01
Copy the volume that contains the Oracle Homes. This is a one time step that is needed when we are setting up a new clone.
ssh pureuser@${FLASH_ARRAY} purevol copy oracle-lvm-prod-002-orasoft.SNAP-$SUFFIX oracle-lvm-dev-002-orasoft
Connect Target Volumes to the Host or Host Group
If we have a cluster of KVM hosts, then we would first create a host group on the FlashArray that includes all the hosts in the cluster and then connect the volumes to the host group. In such case, we would replace --host with --hgroup in the commands below.
ssh pureuser@${FLASH_ARRAY} purevol connect --host sn1-r720-e03-11 oracle-lvm-dev-002-orasoft
ssh pureuser@${FLASH_ARRAY} purevol connect --host sn1-r720-e03-11 oracle-lvm-dev-002-data-01
ssh pureuser@${FLASH_ARRAY} purevol connect --host sn1-r720-e03-11 oracle-lvm-dev-002-fra-01
ssh pureuser@${FLASH_ARRAY} purevol connect --host sn1-r720-e03-11 oracle-lvm-dev-002-redo-01�
Update Multipath Configuration
Create multipath aliases for the new volumes on the host.
multipath {
wwid 3624a937058f0a8a5b304695a00092778
alias oracle-lvm-dev-002-data-01
}
multipath {
wwid 3624a937058f0a8a5b304695a00092781
alias oracle-lvm-dev-002-fra-01
}
multipath {
wwid 3624a937058f0a8a5b304695a00092782
alias oracle-lvm-dev-002-redo-01
}
multipath {
wwid 3624a937058f0a8a5b304695a00092785
alias oracle-lvm-dev-002-orasoft
}
Restart the multipath service and make sure that the paths have been added.
[root@sn1-r720-e03-11 ~]# multipath -ll|grep -i 58F0A8A5B304695A00092
oracle-lvm-dev-002-fra-01 (3624a937058f0a8a5b304695a00092781) dm-69 PURE ,FlashArray
oracle-lvm-dev-002-data-01 (3624a937058f0a8a5b304695a00092778) dm-68 PURE ,FlashArray
oracle-lvm-dev-002-orasoft (3624a937058f0a8a5b304695a00092785) dm-67 PURE ,FlashArray
oracle-lvm-dev-002-redo-01 (3624a937058f0a8a5b304695a00092782) dm-71 PURE ,FlashArray
Add Virtual Disks to the Clone VM
Next, we need to add the 4 cloned volumes as 4 disks to the clone VM.
Go to the virtual machine details page and click on Disk. Then click on New button at the top to add a new virtual disk to the VM. Create a new disk for each of the four volumes. The multipath alias would be listed under the LUN ID column. If not using multipath, the volume serial number can be used to identify the volume.
Repeat this step for the remaining disks.
At this point, all 4 disks should be visible in the VM.
[root@oracle-lvm-prod-002 /]# blkid
/dev/mapper/ol_oracle--lvm--prod--001-root: UUID="8b672ccb-974f-43c7-8122-6b8cc388616c" TYPE="xfs"
/dev/sda2: UUID="HVNj9Q-FlAZ-bZu7-DFWQ-um5M-MzTU-e4T8pq" TYPE="LVM2_member"
/dev/sda1: UUID="0402467d-3bcb-4302-af58-a6ef9d07db4f" TYPE="xfs"
/dev/mapper/ol_oracle--lvm--prod--001-swap: UUID="92ed2b9f-07f2-438b-819f-62399a139e45" TYPE="swap"
/dev/mapper/ol_oracle--lvm--prod--001-home: UUID="6e6f88a6-9531-4897-821f-4df3d0a39fb9" TYPE="xfs"
/dev/sdb1: LABEL="ASM_LVMPRD01_DATA01" TYPE="oracleasm"
/dev/sdc1: LABEL="ASM_LVMPRD01_FRA01" TYPE="oracleasm"
/dev/sdd1: LABEL="ASM_LVMPRD01_REDO" TYPE="oracleasm"
/dev/sde: UUID="33d1aec8-c6a7-4fd1-ad4e-6867f800259b" TYPE="xfs"
Mount Software Volume
As we cloned the VM from the source, the /u01 mount point for the software directory is already present. Make any changes to the /etc/fstab file if required. In this case, no changes were needed as we were using the UUID instead of the file system path.
UUID=33d1aec8-c6a7-4fd1-ad4e-6867f800259b /u01 xfs defaults 0 0
Mount /u01 if it did not get automatically mounted.
Scan ASM Disks
As the target volumes have now been refreshed from production, the ASM disk names need to be updated to correspond to the target names.
If using ASMLib, rename the disks of the cloned ASM volumes as shown below.
[root@oracle-lvm-prod-002 /]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "ASM_LVMPRD01_DATA01"
Instantiating disk "ASM_LVMPRD01_FRA01"
Instantiating disk "ASM_LVMPRD01_REDO"
Restart the VM
At this point, all configuration, software and disks have been restored to look like the source. We restart the VM so that ASM and database can start automatically.
[root@oracle-lvm-prod-002 ~]# ps -ef|grep smon
grid 6083 1 0 05:44 ? 00:00:00 asm_smon_+ASM
oracle 6261 1 0 05:44 ? 00:00:00 ora_smon_lvmprd01
root 6677 6626 0 05:45 pts/0 00:00:00 grep --color=auto smon