Cloning databases on virtual machine disks can be challenging if you are after a granular level of cloning, such as perdatabase. Most existing or legacy VMware environments have multiple databases on a single virtual machine disk with this type of configuration. When we take a protection group snapshot of the datastore volumes, we snapshot all the databases.
If we are looking to only snapshot and clone a single database, then that database needs to be on its own virtual machine disk datastore. The following example walks through setting up a database per virtual machine disk and cloning that database.
-
Identify the storage volumes on the FlashArray that make up the source database volumes.
-
Create the volumes of the clone databases, either from the snapshots of the source volumes or from scratch.
-
Attach the clone volumes to the VMware ESX host or cluster.
-
Copy the source datastore volume to the clone datastore volume.
-
Create the clone datastore with a new signature.
-
Set up the virtual machine for the clone database, and then attach clone volumes.
-
Start up the clone database.
-
Identify the source volumes that make up the virtual machine disk datastore.
-
In the example shown in Figure 21, the volume of the source datastore is called ora-ds-vmdk-cb, it's connected to SYD-Demo-Cluster1, the logical unit number is 175, and the serial number ends in C1DE.
Identify the source volumes that make up the virtual machine disk datastore.
-
Confirm the device back end from the VMware ESX environment. Figure 22 shows the correct logical unit number; it matches the serial number from Figure 21.
Confirm the device back end from the VMware ESX environment
-
-
Confirm the Oracle virtual machine, ora5, is using the correct virtual machine disk. Figure 23 shows a 100GB disk created on the virtual machine disk called ora-ds-vmdk-cb, which is mounted on the ora5 Linux host.
Confirm the Oracle virtual machine, ora5, is using the correct virtual machine disk
-
Create the protection group for the virtual machine disk datastore volumes, and then add the datastore volume ora-dsvmdk-cb to the protection group.
Creating a protection group and adding the volume to it.
-
Take the protection-group snapshot; the example in Figure 25 uses the suffix snap1 to create the protection-group snapshot; the snapshot name is ora5-pg.snap1.ora-ds-vmdk.cb.
Take the protection group snapshot.
-
Create a new clone volume of the datastore volumes from the protection-group snapshot. Note that the volume is called oradf-vmdk-clone-db; this will be the new name for the clone datastore. The volume is connected to the SYD-Demo-Cluster with serial number C553.
Create a new clone volume of the datastore volumes from the protection-group snapshot.
-
Once the clone volume is attached to the host, scan for new volumes using the VMware ESX cluster.
Scan for new volumes using the VMware ESX cluster.
-
Create a new datastore from the clone volume:
-
Select New Datastore.
-
Select VMFS.
-
Enter the new clone datastore name, ora-ds-vmdk-clone-cb using LUN 174 S/N C553.
Create a new datastore for the clone volume.
-
-
Because we are cloning an existing datastore, we need to write a new signature to the datastore; otherwise, we will get a signature conflict error.
Write a new signature to the datastore to avoid a signature conflict error.
-
The new clone datastore is imported with the new name allocated to it. We can now use this datastore to present the clone disk to the same virtual machine or to another virtual machine. In the example shown in Figure 30, we present the clone disk to a new host called ora5-clone.
The new clone datastore is imported with the new name allocated to it
-
Select the new ora5-clone virtual machine, click Actions, and then click Edit settings.
-
Select Add device.
-
Select Existing hard drive.
-
You will see the new clone datastore. Select the datastore and then the ora5-vmdk disk to attach.
Showing the new clone datastore.
-
The new disk is now attached to the ora5-clone virtual machine. We can confirm this from the Edit Settings tab, which also shows that the operating system can see the new 100GB clone volume.
The new disk is now attached to the ora5-clone virtual machine, as seen in the Edit Settings tab
-
Mount the volume, start up the Oracle database, and confirm that the table we created on ora5 is present.
mkdir /u01 mount /dev/sdb1 /u01 su - oracle sqlplus / as sysdba select count(*) from tb1; [oracle@ora5-clone ~]$ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 7.7G 0 7.7G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 26M 7.7G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/mapper/ol-root 50G 7.4G 43G 15% / /dev/sda1 1014M 314M 701M 31% /boot /dev/mapper/ol-home 42G 39M 42G 1% /home tmpfs 1.6G 4.0K 1.6G 1% /run/user/42 tmpfs 1.6G 44K 1.6G 1% /run/user/1000 /dev/sdb1 100G 11G 90G 11% /u01 /dev/sdc1 50G 743M 50G 2% /u02 tmpfs 1.6G 0 1.6G 0% /run/user/54321[oracle@ora5-clone ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jan 30 08:52:18 2025 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> SQL> select count(*) from tb1; COUNT(*) ---------- 72373