Skip to main content
Pure Technical Services

Cloning an Oracle Database on VMware Virtual Volumes

 

In Virtualize an Oracle Database on VMware using Virtual Volumes we learned how to set up VMware Center to use Virtual Volumes (vVols) on the FlashArray™. We also learned how one could migrate an Oracle database running on a physical host to a virtual machine (VM) without actually moving any data.

In any IT organization, there is a constant need to create copies or clones of production environments for various purposes like development, QA, performance testing, reporting, etc. In this article, we will go through the process of creating a new VM that is a clone of a VM running an Oracle database on vVols.  

In this example scenario, as the source, we have an Oracle database vvprd01 running on a VM called vm-ora-vvol-prod-01

  • This VM has 4 vVol disks that have been set up as follows: 

    • Disk 1 - Operating system - Oracle Linux 7

    • Disk 2 - xfs file system created and is mounted as /u01. Oracle and Grid software is installed here.

    • Disk 3 - ASM disk for DATA disk group

    • Disk 4 - ASM disk for FRA disk group

There exists a protection group vvpro01_pg on the FlashArray that contains DATA and FRA volumes.

1. In vCenter, go to the Hosts and Clusters view. Select the vm-ora-vvol-prod-01 VM, right-click and select Clone -> Clone to Virtual Machine....

Provide a new name for the Clone VM.

clipboard_e07e5083ae5bb06214530452426ad2d60.png

 

2. Select the cluster.

clipboard_ec74cca3ff3413c8e58c2ce4153503cfd.png

 

3. Select the vVol datastore.

clipboard_e152c80f3a809fc02bd2042512ebf844a.png

 

4. We do not want the virtual machine to start immediately so Power on virtual machine after creation checkbox should be unchecked.

clipboard_e1e77b870d4dc7ac8b80b154c7ac458f2.png

 

5. Click on Finish and the task to clone the virtual machine will be submitted.

clipboard_e60def9f510d2922ebbb0f75f00e6ef6e.png

 

When the task to clone the VM completes, login to the FlashArray and go to Storage -> Volumes. We can see that a new Volume Group is automatically created. Furthermore, Data vVols of the source VM were also copied and placed into this volume group. The name of the cloned VM is used to name the volume group and volumes which makes it easy to identify them.   

clipboard_e9bb451256687fd317613a0040f505cd2.png

 

In the Hosts and Clusters view. Select the vm-ora-vvol-prod-01 VM, right-click and select Edit Settings.

Uncheck the checkboxes as shown below so that that cloned VM does not attempt to connect to the Network.

When a VMware clones a VM it assigns a new MAC address to the network adapters. Make a note of the new network address, we will need this to configure the operating system network settings.

clipboard_ef72b765f62eb0bd2a28074bdcbbbed47.png

 

At this point, we can start up the VM.

Log in to Oracle Linux as root. Edit the network configuration file located in /etc/sysconfig/network-scripts directory and change the MAC address to the one obtained in the previous step. In addition, update this file with a new IP address for the cloned VM.

clipboard_e489903e00ee93fe014f69d1eac58543b.png

Restart the network service. The network should come up with the new IP address. Go back to the Edit Settings screen, and check both checkboxes that we had unchecked earlier for the network adapter.

Using commands like lsblk, lsscsi and blkid, make sure that the scsi devices corresponding to the ASM are visible at the operating system.

In our setup ASM is using udev rules, so we'll update /etc/udev/rules.d/99-asm with the new SCSI IDs assigned to the ASM volumes. 

In case of ASMLib, use "oracleasm scandisks" command to make ASMLib become aware of the disks. 

 

The ASM disk groups can now be mounted.

ASMCMD> lsdg --discovery
State       Type  Rebal  Sector  Logical_Sector  Block  AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
DISMOUNTED        N           0               0      0   0         0        0                0               0              0             N  DATA/
DISMOUNTED        N           0               0      0   0         0        0                0               0              0             N  FRA/

ASMCMD> mount DATA
ASMCMD> mount FRA

ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304   2097152  2094668                0         2094668              0             N  DATA/
MOUNTED  EXTERN  N         512             512   4096  1048576   1048576  1047875                0         1047875              0             N  FRA/ 

 

After the disk groups are mounted, we can go ahead and start the database.

[oracle@vm-ora-vvol-prod-01 ~]$ srvctl start database -d vvprd01
[oracle@vm-ora-vvol-prod-01 ~]$ ps -ef|grep smon
grid      5971     1  0 Apr21 ?        00:00:00 asm_smon_+ASM
oracle   23317     1  0 02:00 ?        00:00:00 ora_smon_vvprd01

 

We have seen how we can make a clone of an Oracle database running on VMware with vVol datastore within a matter of minutes. Thanks to the tight integration between the virtual volumes and the FlashArray, the task of copying the FlashArray volumes for the cloned VM was done for us automatically and we did not even have to log into the FlashArray.

You might have noticed that we did not change the hostname of the cloned VM. This was done on purpose. That's because changing the hostname will break Oracle Grid Infrastructure configuration and neither ASM nor the database will come up.

To reconfigure Grid Infrastructure configuration, so that ASM comes back up after the hostname change, a few additional steps need to be performed. These steps are discussed in detail in Cloning Oracle Grid Infrastructure for a Standalone Server.