Now that we have our ORATEST database provisioned (see Nutanix Era blog part 3), that we could run snapshot and take Log Catch Up (see Nutanix Era Blog part 4), we will now see how we can clone an oracle database.

For more information on Nutanix products, I would encourage you to visit Nutanix website.

Database Menu

Source database and clone database list are reachable from Nutanix Era Databases menu :












You can list the source databases :


You can list the clone databases :


Clone a source database

Clone databases are created from the Nutanix Era Time Machines menu :












Authorize Database Servers VMs

During a clone of a source database we can decide either to create a new VM that will host the clone, or to use an existing one that is already part of the authorize database servers VMs. Those authorized VM can be managed from the “Authorize Database Servers VMs” Menu that can be reachable clicking on Actions after having selected the appropriate Time Machine of the source database we would like to clone :












We just need to move the appropriate existing VM we would like to host our future clone.








Here in our example, we will authorized the VM named ORADEMO1-VM_clone :








This can also be done directly from the clone menu clicking the + button :




It is important to know that for Oracle database case, only VM created for clones can be added to the authorized database servers VMs and host other clones. Source database VMs can not be added to the authorised VM list been able to host clones.

Let’s clone an oracle database!

Let’s clone our oracle source database ORATEST that we provisioned earlier.

Clicking on the ORATEST_TM source database time machine, we will be able to enter the Time Machine part for that specific source database. From the Actions menu, we will click on “Create Single Instance Database Clone” :






We can create the clone based on existing snapshot or using “Point in Time”. For oracle database this would restore the previous snapshot and recover all archive logs that was secured during Log Catch Up. Let’s clone our database using the last “Point in Time”.










We will use existing ORADEMo1-VM_clone clone VM :






We will give a name for the database clone and push the button clone :






Note that we could schedule automatic refresh of the clone by using below option :


And we could give the refresh frequency and the time when the refresh needs to be executed :






And remove the schedule after a number of days :




The cloning output can be seen from the operations menu :






What is happening exactly during the cloning?

Source database

On the source database, nothing :

oracle@test1-VM:/home/oracle/ [ORATEST] taa
2021-09-29T08:04:17.112961+00:00
NET  (PID:350610): Archived Log entry 645 added for T-1.S-654 ID 0xd7835926 LAD:1
2021-09-29T08:33:12.862502+00:00
ALTER SYSTEM ARCHIVE LOG
2021-09-29T08:33:12.884826+00:00
Thread 1 advanced to log sequence 656 (LGWR switch),  current SCN: 3913958
  Current log# 2 seq# 656 mem# 0: /u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/onlinelog/o1_mf_2_jk7r196j_.log
  Current log# 2 seq# 656 mem# 1: /u02/app/oracle/oradata/fra_ORATEST/ORATEST/onlinelog/o1_mf_2_jk7r19gf_.log
2021-09-29T08:33:12.982560+00:00
NET  (PID:360220): Archived Log entry 646 added for T-1.S-655 ID 0xd7835926 LAD:1
2021-09-29T09:02:12.738644+00:00
ALTER SYSTEM ARCHIVE LOG
2021-09-29T09:02:12.759186+00:00
Thread 1 advanced to log sequence 657 (LGWR switch),  current SCN: 3915489
  Current log# 3 seq# 657 mem# 0: /u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/onlinelog/o1_mf_3_jk7r1986_.log
  Current log# 3 seq# 657 mem# 1: /u02/app/oracle/oradata/fra_ORATEST/ORATEST/onlinelog/o1_mf_3_jk7r19lz_.log
2021-09-29T09:02:12.822721+00:00
NET  (PID:369894): Archived Log entry 647 added for T-1.S-656 ID 0xd7835926 LAD:1


Clone VM

On the clone VM, before cloning, there is no database file system. Only /u02 which will contain the oracle binaries (ORACLE_HOME) and other file system used for Era engine. :

[oracle@ORADEMO1-VM-clo trace]$ df -h
Filesystem                                                                                                                      Size  Used Avail Use% Mounted on
devtmpfs                                                                                                                        7.7G     0  7.7G   0% /dev
tmpfs                                                                                                                            12G     0   12G   0% /dev/shm
tmpfs                                                                                                                           7.7G   17M  7.7G   1% /run
tmpfs                                                                                                                           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/vgroot--lv-root                                                                                                     6.0G  118M  5.9G   2% /
/dev/mapper/vgroot--lv-usr                                                                                                      3.0G  1.6G  1.5G  53% /usr
/dev/mapper/vgroot--lv-var                                                                                                      3.0G  448M  2.6G  15% /var
/dev/mapper/vgroot--lv-home                                                                                                     4.0G   73M  4.0G   2% /home
/dev/mapper/vgroot--lv-opt                                                                                                      4.0G   69M  4.0G   2% /opt
/dev/mapper/vgroot--lv-tmp                                                                                                      3.0G  954M  2.1G  32% /tmp
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_software_ff05dbb5a2084503b80ccc72156b5383  2.9G  668M  2.1G  25% /opt/era_base/era_engine
/dev/sda1                                                                                                                       496M  224M  273M  46% /boot
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_logs_ff05dbb5a2084503b80ccc72156b5383      7.7G   55M  7.2G   1% /opt/era_base/logs
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_config_ff05dbb5a2084503b80ccc72156b5383     93M  1.6M   85M   2% /opt/era_base/cfg
/dev/sda2                                                                                                                      1022M   12K 1022M   1% /boot/efi
tmpfs                                                                                                                           1.6G     0  1.6G   0% /run/user/54321
/dev/sdb                                                                                                                         50G  9.8G   38G  21% /u02


Also no ORACLE_SID defined in the oratab file :

[oracle@ORADEMO1-VM-clo trace]$ cat /etc/oratab
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
rdbms_19000_1:/u02/app/oracle/product/19.0.0/dbhome_1:D
[oracle@ORADEMO1-VM-clo trace]$


After some pre-processing actions and checking the database layout information that are provided, Nutanix Era system will restore the appropriate snapshot.

Once this is done, the recovering part will begin. We will see that now we have some new file system been mounted :

[oracle@ORADEMO1-VM-clo trace]$ df -h
Filesystem                                                                                                                      Size  Used Avail Use% Mounted on
devtmpfs                                                                                                                        7.7G     0  7.7G   0% /dev
tmpfs                                                                                                                            12G  184K   12G   1% /dev/shm
tmpfs                                                                                                                           7.7G   17M  7.7G   1% /run
tmpfs                                                                                                                           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/vgroot--lv-root                                                                                                     6.0G  118M  5.9G   2% /
/dev/mapper/vgroot--lv-usr                                                                                                      3.0G  1.6G  1.5G  53% /usr
/dev/mapper/vgroot--lv-var                                                                                                      3.0G  450M  2.6G  15% /var
/dev/mapper/vgroot--lv-home                                                                                                     4.0G   74M  4.0G   2% /home
/dev/mapper/vgroot--lv-opt                                                                                                      4.0G   69M  4.0G   2% /opt
/dev/mapper/vgroot--lv-tmp                                                                                                      3.0G  954M  2.1G  32% /tmp
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_software_ff05dbb5a2084503b80ccc72156b5383  2.9G  668M  2.1G  25% /opt/era_base/era_engine
/dev/sda1                                                                                                                       496M  224M  273M  46% /boot
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_logs_ff05dbb5a2084503b80ccc72156b5383      7.7G   57M  7.2G   1% /opt/era_base/logs
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_config_ff05dbb5a2084503b80ccc72156b5383     93M  1.6M   85M   2% /opt/era_base/cfg
/dev/sda2                                                                                                                      1022M   12K 1022M   1% /boot/efi
tmpfs                                                                                                                           1.6G     0  1.6G   0% /run/user/54321
/dev/sdb                                                                                                                         50G  9.8G   38G  21% /u02
/dev/mapper/ntnx_era_dg_log_vg_47aab96bac4343b2a4a73453130a22fd-ntnx_era_agent_lv_47aab96bac4343b2a4a73453130a22fd              197G  8.8G  178G   5% /tmp/era_recovery_staging_area_ORATCL1
/dev/mapper/oradata_ORATEST_vg_ORATCL1-oradata_ORATEST_lv                                                                        20G  3.3G   16G  18% /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1
/dev/mapper/oradata_fra_ORATEST_vg_ORATCL1-oradata_fra_ORATEST_lv                                                               9.8G  3.1G  6.2G  34% /u02/app/oracle/oradata/fra_ORATEST_ORATCL1


The file system /tmp/era_recovery_staging_area_ORATCL1 will contain the restored Log Catch Up file (archive log files) :

[oracle@ORADEMO1-VM-clo trace]$ ls -l /tmp/era_recovery_staging_area_ORATCL1/logs_0/20210929*
/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210929080417_20210929083312:
total 54284
-rwxr-xr-x. 1 oracle root 12173312 Sep 29 08:34 control01_1084523635.ctl
-rwxr-xr-x. 1 oracle root 43411456 Sep 29 08:34 o1_mf_1_655_jo8968wd_.arc

/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210929083312_20210929090212:
total 15388
-rwxr-xr-x. 1 oracle root 12173312 Sep 29 09:03 control01_1084525374.ctl
-rwxr-xr-x. 1 oracle root  3584000 Sep 29 09:03 o1_mf_1_656_jo8bwns0_.arc


This will be used to restore the archive log in the appropriate FRA stored in the /u02/app/oracle/oradata/fra_ORATEST_ORATCL1 file system. There will be 2 directories : one with the source database name and another one with the clone database name :

[oracle@ORADEMO1-VM-clo trace]$ ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1
total 24
drwx------. 2 oracle oinstall 16384 Aug 11 14:31 lost+found
drwxr-x---. 3 oracle oinstall  4096 Sep 29 09:14 ORATCL1
drwxr-x---. 6 oracle oinstall  4096 Aug 11 14:54 ORATEST


The clone database FRA will be first empty, as the restore and recover will be done with the source database name (db_name=ORATEST) :

[oracle@ORADEMO1-VM-clo trace]$ ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/archivelog/2021_09_29/
total 0
[oracle@ORADEMO1-VM-clo trace]$


The FRA with the source database will contain the restored archive logs if they would be needed :

[oracle@ORADEMO1-VM-clo trace]$ ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATEST/archivelog/2021_09_26
total 29400
-rw-rw----. 1 oracle oinstall  3886592 Sep 26 00:13 o1_mf_1_602_jnzgrr6g_.arc
-rw-rw----. 1 oracle oinstall 22735872 Sep 26 00:42 o1_mf_1_603_jnzjhdog_.arc
-rw-rw----. 1 oracle oinstall  3478528 Sep 26 01:00 o1_mf_1_604_jnzkjv9h_.arc


The datafile file system /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1 will contain datafiles for the new clone in 2 sub-directories : One with the source database name and one with the clone database name. :

[oracle@ORADEMO1-VM-clo trace]$ ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/
total 2.7G
-rw-r-----. 1 oracle oinstall  5.1M Sep 29 09:21 o1_mf_users_jk7r05t2_.dbf
-rw-r-----. 1 oracle oinstall  513M Sep 29 09:21 o1_mf_undotbsp_jk7rk221_.dbf
-rw-r-----. 1 oracle oinstall  1.2G Sep 29 09:26 o1_mf_sysaux_jk7qzopd_.dbf
-rw-r-----. 1 oracle oinstall 1001M Sep 29 09:26 o1_mf_system_jk7qywmo_.dbf
[oracle@ORADEMO1-VM-clo trace]$ ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile/
total 1.1G
-rw-r-----. 1 oracle oinstall 257M Sep 29 09:19 o1_mf_temptbs__jo8cs8w2_.tmp
-rw-r-----. 1 oracle oinstall 1.1G Sep 29 09:26 o1_mf_undotbs__jo8ct5gs_.dbf
[oracle@ORADEMO1-VM-clo trace]$


Once restore will be completed, the clone database will have its own archive logs :

[oracle@ORADEMO1-VM-clo trace]$ ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/archivelog/
total 4
drwxr-x---. 2 oracle oinstall 4096 Sep 29 09:16 2021_09_29

[oracle@ORADEMO1-VM-clo trace]$ ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/archivelog/2021_09_29/
total 25672
-rw-r-----. 1 oracle oinstall 22735872 Sep 29 09:16 o1_mf_1_603_jo8cr0vn_.arc
-rw-r-----. 1 oracle oinstall  3478528 Sep 29 09:16 o1_mf_1_604_jo8cr0sr_.arc
-rw-r-----. 1 oracle oinstall    67584 Sep 29 09:16 o1_mf_1_605_jo8cr0ts_.arc


Once the clone database operation is completed, the /tmp/era_recovery_staging_area_ORATCL1 file system will disappear :

[oracle@ORADEMO1-VM-clo trace]$ df -h
Filesystem                                                                                                                      Size  Used Avail Use% Mounted on
devtmpfs                                                                                                                        7.7G     0  7.7G   0% /dev
tmpfs                                                                                                                            12G     0   12G   0% /dev/shm
tmpfs                                                                                                                           7.7G   17M  7.7G   1% /run
tmpfs                                                                                                                           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/vgroot--lv-root                                                                                                     6.0G  118M  5.9G   2% /
/dev/mapper/vgroot--lv-usr                                                                                                      3.0G  1.6G  1.5G  53% /usr
/dev/mapper/vgroot--lv-var                                                                                                      3.0G  456M  2.6G  15% /var
/dev/mapper/vgroot--lv-home                                                                                                     4.0G   73M  4.0G   2% /home
/dev/mapper/vgroot--lv-opt                                                                                                      4.0G   69M  4.0G   2% /opt
/dev/mapper/vgroot--lv-tmp                                                                                                      3.0G  981M  2.1G  33% /tmp
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_software_ff05dbb5a2084503b80ccc72156b5383  2.9G  668M  2.1G  25% /opt/era_base/era_engine
/dev/sda1                                                                                                                       496M  224M  273M  46% /boot
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_logs_ff05dbb5a2084503b80ccc72156b5383      7.7G   60M  7.2G   1% /opt/era_base/logs
/dev/mapper/ntnx_era_agent_vg_ff05dbb5a2084503b80ccc72156b5383-ntnx_era_agent_lv_era_config_ff05dbb5a2084503b80ccc72156b5383     93M  1.6M   85M   2% /opt/era_base/cfg
/dev/sda2                                                                                                                      1022M   12K 1022M   1% /boot/efi
tmpfs                                                                                                                           1.6G     0  1.6G   0% /run/user/54321
/dev/sdb                                                                                                                         50G  9.8G   38G  21% /u02
/dev/mapper/oradata_ORATEST_vg_ORATCL1-oradata_ORATEST_lv                                                                        20G  4.3G   15G  24% /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1
/dev/mapper/oradata_fra_ORATEST_vg_ORATCL1-oradata_fra_ORATEST_lv                                                               9.8G  3.1G  6.2G  34% /u02/app/oracle/oradata/fra_ORATEST_ORATCL1
[oracle@ORADEMO1-VM-clo trace]$


If we study the alert log file, we can easily understand most important steps of what happened during the clone :

[oracle@ORADEMO1-VM-clo trace]$ pwd
/u02/app/oracle/diag/rdbms/oratcl1/ORATCL1/trace

[oracle@ORADEMO1-VM-clo trace]$ ls -l alert_ORATCL1.log
-rw-r-----. 1 oracle oinstall 263969 Sep 29 09:21 alert_ORATCL1.log

[oracle@ORADEMO1-VM-clo trace]$ more alert_ORATCL1.log


We can first note the following :

  • The parameter file has been restored
  • The OMF create parameters have been set
  • The recovery file destination has been set
  • The instance name and db_unique_name has been set to the clone one
  • The db_name is still the source one
Using parameter settings in server-side spfile /u02/app/oracle/product/19.0.0/dbhome_1/dbs/spfileORATCL1.ora
System parameters with non-default values:
  processes                = 300
  nls_language             = "AMERICAN"
  nls_territory            = "AMERICA"
  filesystemio_options     = "SETALL"
  sga_target               = 2G
  memory_target            = 0
  control_files            = "/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/controlfile/o1_mf_jk7r16xw_.ctl"
  control_files            = "/u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATEST/controlfile/o1_mf_jk7r16ys_.ctl"
  db_block_size            = 8192
  compatible               = "19.0.0"
  log_archive_dest_1       = "LOCATION=USE_DB_RECOVERY_FILE_DEST"
  log_archive_format       = "%t_%s_%r.dbf"
  db_create_file_dest      = "/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1"
  db_create_online_log_dest_1= "/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1"
  db_create_online_log_dest_2= "/u02/app/oracle/oradata/fra_ORATEST_ORATCL1"
  db_recovery_file_dest    = "/u02/app/oracle/oradata/fra_ORATEST_ORATCL1"
  db_recovery_file_dest_size= 10G
  fast_start_mttr_target   = 300
  undo_tablespace          = "UNDOTBSP1"
  remote_login_passwordfile= "EXCLUSIVE"
  instance_name            = "ORATCL1"
  shared_servers           = 0
  audit_file_dest          = "/u02/app/oracle/admin/ORATCL1/adump"
  audit_trail              = "DB"
  db_name                  = "ORATEST"
  db_unique_name           = "ORATCL1"
  open_cursors             = 300
  parallel_threads_per_cpu = 1
  pga_aggregate_target     = 1G
  dg_broker_start          = FALSE
  diagnostic_dest          = "/u02/app/oracle"


Database has been started in mount mode using exclusive mode :

Database mounted in Exclusive Mode
Lost write protection disabled
.... (PID:32835): Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST [krsd.c:18222]
Completed: alter database mount


Datafiles have been renamed to the new file system snapshot mounted on the clone VMs.

2021-09-29T09:15:50.060562+00:00
						alter database rename file '/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf' to '/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1
/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf'
2021-09-29T09:15:50.074132+00:00
Deleted Oracle managed file /u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf
Completed: 						alter database rename file '/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf' to '/u02/app/oracle/oradata/datafiles_ORATEST
_ORATCL1/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf'
						alter database rename file '/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf' to '/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1
/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf'
Deleted Oracle managed file /u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf
Completed:


The needed archive logs will now be restored using the temporary Log Catch Up file system (/tmp/era_recovery_staging_area_ORATCL1) :

alter database recover
 if needed start until time '2021/09/29 08:04:17' using backup controlfile
2021-09-29T09:16:33.631940+00:00
Media Recovery Start
 Started logmerger process
2021-09-29T09:16:33.691420+00:00
Parallel Media Recovery started with 2 slaves
ORA-279 signalled during: alter database recover
 if needed start until time '2021/09/29 08:04:17' using backup controlfile
...
alter database recover logfile '/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926004220_20210926010104/o1_mf_1_605_jnzkljv2_.arc'
2021-09-29T09:16:34.276907+00:00
Media Recovery Log /tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926004220_20210926010104/o1_mf_1_605_jnzkljv2_.arc
ORA-279 signalled during: alter database recover logfile '/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926004220_20210926010104/o1_mf_1_605_jnzkljv2_.arc'...
alter database recover logfile '/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926010104_20210926013011/o1_mf_1_606_jnzm93vc_.arc'
2021-09-29T09:16:34.483362+00:00
Media Recovery Log /tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926010104_20210926013011/o1_mf_1_606_jnzm93vc_.arc
ORA-279 signalled during: alter database recover logfile '/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926010104_20210926013011/o1_mf_1_606_jnzm93vc_.arc'...
alter database recover logfile '/tmp/era_recovery_staging_area_ORATCL1/logs_0/20210926013011_20210926015916/o1_mf_1_607_jnznznq5_.arc'


The online log file will be cleared :

NET  (PID:33711): Clearing online redo logfile 1 /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_1_jk7r195y_.log
NET  (PID:33711): Clearing online redo logfile 2 /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_2_jk7r196j_.log
NET  (PID:33711): Clearing online redo logfile 3 /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_3_jk7r1986_.log
Clearing online log 1 of thread 1 sequence number 604
Clearing online log 2 of thread 1 sequence number 605
Clearing online log 3 of thread 1 sequence number 603
2021-09-29T09:16:51.991586+00:00
NET  (PID:33711): Clearing online redo logfile 1 complete
NET  (PID:33711): Clearing online redo logfile 2 complete
NET  (PID:33711): Clearing online redo logfile 3 complete
Resetting resetlogs activation ID 3615709478 (0xd7835926)
Online log /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_1_jk7r195y_.log: Thread 1 Group 1 was previously cleared
Online log /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_1_jk7r19br_.log: Thread 1 Group 1 was previously cleared
Online log /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_2_jk7r196j_.log: Thread 1 Group 2 was previously cleared
Online log /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_2_jk7r19gf_.log: Thread 1 Group 2 was previously cleared
Online log /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_3_jk7r1986_.log: Thread 1 Group 3 was previously cleared
Online log /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATEST/onlinelog/o1_mf_3_jk7r19lz_.log: Thread 1 Group 3 was previously cleared


Database name has been changed to new clone name :

Succesfully changed database name and ID.
*** DBNEWID utility finished succesfully ***


And we can see that db_name is now appropriately set to the new clone name :

Using parameter settings in client-side pfile /u02/app/oracle/product/19.0.0/dbhome_1/dbs/initORATCL1.ora on machine ORADEMO1-VM-clo
System parameters with non-default values:
  processes                = 300
  nls_language             = "AMERICAN"
  nls_territory            = "AMERICA"
  filesystemio_options     = "SETALL"
  service_names            = "ORATCL1"
  sga_target               = 2G
  memory_target            = 0
  control_files            = "/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/controlfile/o1_mf_jk7r16xw_.ctl"
  control_files            = "/u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATEST/controlfile/o1_mf_jk7r16ys_.ctl"
  db_block_size            = 8192
  compatible               = "19.0.0"
  log_archive_dest_1       = "LOCATION=USE_DB_RECOVERY_FILE_DEST"
  log_archive_format       = "%t_%s_%r.dbf"
  db_create_file_dest      = "/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1"
  db_create_online_log_dest_1= "/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1"
  db_create_online_log_dest_2= "/u02/app/oracle/oradata/fra_ORATEST_ORATCL1"
  db_recovery_file_dest    = "/u02/app/oracle/oradata/fra_ORATEST_ORATCL1"
  db_recovery_file_dest_size= 10G
  fast_start_mttr_target   = 300
  undo_tablespace          = "UNDOTBS_ORATCL1"
  remote_login_passwordfile= "EXCLUSIVE"
  instance_name            = "ORATCL1"
  dispatchers              = "(PROTOCOL=tcp)(LISTENER=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.129.51)(PORT=1521)))"
  shared_servers           = 0
  local_listener           = "(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.129.51)(PORT=1521))"
  job_queue_processes      = 40
  audit_file_dest          = "/u02/app/oracle/admin/ORATCL1/adump"
  audit_trail              = "DB"
  db_name                  = "ORATCL1"
  db_unique_name           = "ORATCL1"
  open_cursors             = 300
  parallel_threads_per_cpu = 1
  pga_aggregate_target     = 1G
  dg_broker_start          = FALSE
  diagnostic_dest          = "/u02/app/oracle"
2021-09-29T09:20:00.695139+00:00


Finally, the oratab will now contain the new ORACLE SID:

[oracle@ORADEMO1-VM-clo ~]$ cat /etc/oratab
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
rdbms_19000_1:/u02/app/oracle/product/19.0.0/dbhome_1:D
ORATCL1:/u02/app/oracle/product/19.0.0/dbhome_1:N
[oracle@ORADEMO1-VM-clo ~]$


Finally we can see our new clone database in the clone database list :




What about the online logs after been cleared?

Online logs have been recreated in appropriate clone database folders :

SQL> select group#, member from v$logfile order by group#;

    GROUP# MEMBER
---------- ----------------------------------------------------------------------------------------------------
         1 /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/onlinelog/o1_mf_1_jo8xsl74_.log
         1 /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/onlinelog/o1_mf_1_jo8xslhc_.log
         2 /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/onlinelog/o1_mf_2_jo8xsloy_.log
         2 /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/onlinelog/o1_mf_2_jo8xslx7_.log
         3 /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/onlinelog/o1_mf_3_jo8xsm4o_.log
         3 /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/onlinelog/o1_mf_3_jo8xsmcj_.log

6 rows selected.


New archive log on the clone database

As we can see the new clone has now the online log file archived in his own FRA, starting new incarnation (sequence 1) :

oracle@ORADEMO1-VM-clo:/home/oracle/ [rdbms_19000_1] ORATCL1
********* dbi services Ltd. *********
STATUS                 : OPEN
DB_UNIQUE_NAME         : ORATCL1
OPEN_MODE              : READ WRITE
LOG_MODE               : ARCHIVELOG
DATABASE_ROLE          : PRIMARY
FLASHBACK_ON           : NO
FORCE_LOGGING          : NO
VERSION                : 19.12.0.0.0
CDB Enabled            : NO
*************************************

oracle@ORADEMO1-VM-clo:/home/oracle/ [ORATCL1] sqh

SQL> !ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/archivelog/2021_09_29/
total 25672
-rw-r-----. 1 oracle oinstall 22735872 Sep 29 09:16 o1_mf_1_603_jo8cr0vn_.arc
-rw-r-----. 1 oracle oinstall  3478528 Sep 29 09:16 o1_mf_1_604_jo8cr0sr_.arc
-rw-r-----. 1 oracle oinstall    67584 Sep 29 09:16 o1_mf_1_605_jo8cr0ts_.arc

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

System altered.

SQL> !ls -l /u02/app/oracle/oradata/fra_ORATEST_ORATCL1/ORATCL1/archivelog/2021_09_29/
total 96572
-rw-r-----. 1 oracle oinstall 72601600 Sep 29 10:31 o1_mf_1_1_jo8j4cb8_.arc
-rw-r-----. 1 oracle oinstall 22735872 Sep 29 09:16 o1_mf_1_603_jo8cr0vn_.arc
-rw-r-----. 1 oracle oinstall  3478528 Sep 29 09:16 o1_mf_1_604_jo8cr0sr_.arc
-rw-r-----. 1 oracle oinstall    67584 Sep 29 09:16 o1_mf_1_605_jo8cr0ts_.arc

SQL>


Clone database datafiles

As we could see previously, datafiles for clone database are stored in 2 subdirectories : ORATEST (source database name) and ORATCL1 (clone database name).

oracle@ORADEMO1-VM-clo:/home/oracle/ [ORATCL1] ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/
total 2.7G
-rw-r-----. 1 oracle oinstall  513M Sep 29 10:36 o1_mf_undotbsp_jk7rk221_.dbf
-rw-r-----. 1 oracle oinstall  5.1M Sep 29 10:36 o1_mf_users_jk7r05t2_.dbf
-rw-r-----. 1 oracle oinstall 1001M Sep 29 11:45 o1_mf_system_jk7qywmo_.dbf
-rw-r-----. 1 oracle oinstall  1.2G Sep 29 11:45 o1_mf_sysaux_jk7qzopd_.dbf

oracle@ORADEMO1-VM-clo:/home/oracle/ [ORATCL1] ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile/
total 1.1G
-rw-r-----. 1 oracle oinstall 257M Sep 29 09:19 o1_mf_temptbs__jo8cs8w2_.tmp
-rw-r-----. 1 oracle oinstall 1.1G Sep 29 11:41 o1_mf_undotbs__jo8ct5gs_.dbf
oracle@ORADEMO1-VM-clo:/home/oracle/ [ORATCL1]


This is certainly due to the fact that when cloning a database the base vDisk is made Read Only and 2 new clones are created. One for the original source and another for the clone. The clones have a block mapping with the existing source block extent. It’s like a copy of the datafiles where only updated block or new block will required new extent space. The source database and the clone database are 2 independant READ/WRITE databases.

This is confirmed when querying the ORATCL1 clone database :

SQL> select name from v$datafile order by name;

NAME
----------------------------------------------------------------------------------------------------
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile/o1_mf_undotbs__jo8ct5gs_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_undotbsp_jk7rk221_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_users_jk7r05t2_.dbf

SQL> select name from v$tempfile order by name;

NAME
----------------------------------------------------------------------------------------------------
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile/o1_mf_temptbs__jo8cs8w2_.tmp

SQL> !du -ha /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile
1.0M	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile/o1_mf_temptbs__jo8cs8w2_.tmp
1.1G	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile/o1_mf_undotbs__jo8ct5gs_.dbf
1.1G	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile

SQL> !du -ha /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile
1001M	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf
5.1M	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_users_jk7r05t2_.dbf
513M	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_undotbsp_jk7rk221_.dbf
1.2G	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf
2.7G	/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile

SQL>


On the ORATEST source database :

SQL> select name from v$datafile order by name;

NAME
----------------------------------------------------------------------------------------------------
/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_undotbsp_jk7rk221_.dbf
/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_users_jk7r05t2_.dbf

SQL> select name from v$tempfile order by name;

NAME
----------------------------------------------------------------------------------------------------
/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_temp_jk7rk1xc_.tmp

SQL> !du -ha /u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/
1001M	/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_system_jk7qywmo_.dbf
3.5M	/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_temp_jk7rk1xc_.tmp
5.1M	/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_users_jk7r05t2_.dbf
513M	/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_undotbsp_jk7rk221_.dbf
1.2G	/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/o1_mf_sysaux_jk7qzopd_.dbf
2.7G	/u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/

SQL>


Let’s create a new tablespace TSTSOURCE on the ORATEST source database. Datafile is only created on the source of course :

SQL> !hostname
test1-VM

SQL> create tablespace TSTSOURCE datafile size 10M autoextend on next 100M maxsize 1G;

Tablespace created.

SQL> !ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST/ORATEST/datafile/
total 2.7G
-rw-r-----. 1 oracle oinstall  129M Sep 29 11:55 o1_mf_temp_jk7rk1xc_.tmp
-rw-r-----. 1 oracle oinstall 1001M Sep 29 12:01 o1_mf_system_jk7qywmo_.dbf
-rw-r-----. 1 oracle oinstall  1.2G Sep 29 12:01 o1_mf_sysaux_jk7qzopd_.dbf
-rw-r-----. 1 oracle oinstall  5.1M Sep 29 12:01 o1_mf_users_jk7r05t2_.dbf
-rw-r-----. 1 oracle oinstall  513M Sep 29 12:01 o1_mf_undotbsp_jk7rk221_.dbf
-rw-r-----. 1 oracle oinstall   11M Sep 29 12:03 o1_mf_tstsourc_jo8ok0yn_.dbf


Let’s create another new tablespace, TSTCLONE, on the ORATCL1 clone database :

SQL> !hostname
ORADEMO1-VM-clo

SQL> create tablespace TSTCLONE datafile size 10M autoextend on next 100M maxsize 1G;

Tablespace created.

SQL> !ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile
total 2.7G
-rw-r-----. 1 oracle oinstall  513M Sep 29 10:36 o1_mf_undotbsp_jk7rk221_.dbf
-rw-r-----. 1 oracle oinstall  5.1M Sep 29 10:36 o1_mf_users_jk7r05t2_.dbf
-rw-r-----. 1 oracle oinstall 1001M Sep 29 12:05 o1_mf_system_jk7qywmo_.dbf
-rw-r-----. 1 oracle oinstall  1.2G Sep 29 12:05 o1_mf_sysaux_jk7qzopd_.dbf

SQL> !ls -ltrh /u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATCL1/datafile
total 1.1G
-rw-r-----. 1 oracle oinstall 257M Sep 29 09:19 o1_mf_temptbs__jo8cs8w2_.tmp
-rw-r-----. 1 oracle oinstall 1.1G Sep 29 12:05 o1_mf_undotbs__jo8ct5gs_.dbf
-rw-r-----. 1 oracle oinstall  11M Sep 29 12:07 o1_mf_tstclone_jo8oq73s_.dbf

SQL>


The new file created in the clone database will be recorded locally in the ORATCL1 directory datafile, and only created on the clone database.

We can even create a table into the users tablespace from the clone database that would be seen only by the clone database :

SQL> !hostname
ORADEMO1-VM-clo

SQL> create table userclone tablespace users as select * from dba_users;

Table created.

SQL> select table_name, tablespace_name from dba_tables where table_name='USERCLONE';

TABLE_NAME TABLESPACE_NAME
---------- ------------------------------
USERCLONE  USERS

SQL> select file_name from dba_data_files where tablespace_name='USERS';

FILE_NAME
----------------------------------------------------------------------------------------------------
/u02/app/oracle/oradata/datafiles_ORATEST_ORATCL1/ORATEST/datafile/o1_mf_users_jk7r05t2_.dbf


This table is not created on the ORATEST source database :

SQL> !hostname
test1-VM

SQL> select table_name, tablespace_name from dba_tables where table_name='USERCLONE';

no rows selected

SQL>


Conclusion

As we could see it is easy to clone a database using Nutanix Era. What can be surprising is that the clone database is composed of datafiles belonging to a directory named as the source database (ORATEST) and datafiles belonging to another directory named as the clone database (ORATCL1). All new files created on the clone will go to the clone directory. Source and clone databases are 2 separate read/write databases. When cloning a database the base vDisk is made Read Only and 2 new clones are created. One for the original VM/database and one for the new clone. On the clone VM, the files from the directory named as the source database are copies from the source database as its status at the point in time cloning. These files are using pointer to the original existing block extent. Updates on block or new inserted data will be added for the file in new extent group belonging to the clone.