Note:

Implement Oracle Zero Downtime Migration 21.5 Cloud Native Disaster Recovery Automation

Introduction

In a typical migration, Oracle Zero Downtime Migration migrates a source database to only one target database (single point of failure). Now in 21.5 version you can also create a Disaster Recovery (DR) strategy during post-migration to be able to respond to and recover from an event that negatively affects your business operations. Two target databases are instantiated during the migration (target primary database and target standby database), where both can be in different regions (to reduce impacts of natural disasters). During post-migration, Oracle Data Guard broker configuration is restored in both target databases to allow cloud native operations like switchover and failover (in the Oracle Database Cloud Service console). For more information, see Creating an Oracle Cloud Native Disaster Recovery Strategy.

Architecture Diagram

Architecture

Oracle Zero Downtime Migration Workflow Steps

  1. Initiate database migration.
  2. Perform a restore from service.
  3. Instantiate standby database on the target primary.
  4. Synchronize primary and standby on the target primary.
  5. Perform restore from service.
  6. Instantiate standby database on the target standby.
  7. Synchronize source and target standbys.
  8. Monitor switchover readiness.
  9. Perform switchover and role transition.
  10. Configure target primary and restore cloud broker configuration.
    1. Oracle Zero Downtime Migration restores cloud broker configuration between cloud target primary and cloud target standby.
    2. Oracle Zero Downtime Migration configures the target primary to ship redo logs to the target standby.
  11. Perform post-validation checks.
  12. Finalize migration process.

Note: Oracle Base Database Service, Oracle Exadata Database Service on Dedicated Infrastructure, Oracle Exadata Database Service on Cloud@Customer, Exadata on-premises, and Oracle Exadata Database Service on Dedicated Infrastructure on Oracle Database@Azure support this workflow.

Prerequisites

Task 1: Pre-Migration Tasks

The following steps explain the prerequisite tasks to complete before the actual migration.

  1. Install the software on the source system. zdmcli build display the version of binaries. For more information, see Install the Software on the Source System.

    enter image description here

  2. As mentioned in the Prerequisites, DR setup has been configured between OCI target primary and target standby Virtual Machine Database System machines as shown in the following image.

    enter image description here

    Database and Server Inventory:

    Name Value
    DB Name & Version Db0403 & 19c
    Source (onprem) hostname databasesource
    OCI “Target Primary” hostname ociserverprimary
    OCI “Target Primary” console display name OCI_FUTURE_PRIMARY
    OCI “Target Standby” hostname ociserverstandby
    OCI “Target Standby” console display name OCI_FUTURE_STANDBY
    PDB Name Db0403_Pdb1
    ZDM server name &Version workshop & 21.5

    The following images shows the OCI target primary database and target standby database systems details.

    enter image description here

    enter image description here

  3. Source database has force logging and archive log mode enabled and it can be verified using the following command.

    select force_logging ,log_mode from v$database;
    FORCE_LOGGING  LOG_MODE
    --------------------------------------- ------------
    YES  ARCHIVELOG
    
  4. Run the tnsping command to test the 1521 port enabled between source and target primary servers and vice versa for log shipping.

  5. Oracle Zero Downtime Migration server should be able to SSH as zdmuser to source and also target primary and target standby servers as OPC user. Here source server OS user is also OPC used in this migration along with target OS OPC username.

    enter image description here

  6. Updated the source server /etc/hosts file with the target primary and target standby information.

    enter image description here

  7. Updated OCI future primary server /etc/hosts file with the entries shown in the following image.

    enter image description here

  8. Updated OCI future standby server ` /etc/hosts` file with the entries shown in the following image.

    enter image description here

  9. Updated Oracle Zero Downtime Migration service host server /etc/hosts file with the entries shown in the following image.

    enter image description here

Task 2: Evaluate Oracle Zero Downtime Migration Job

Verify the Oracle Zero Downtime Migration readiness command using -eval flag command. -eval does not initiate real migration, it will be used for evaluation of prechecks and readiness of environments.

Run the following command:

/u01/app/zdmhome/bin/zdmcli migrate database -rsp /home/zdmuser/physical_online.rsp -sourcedb DB0403_sourcedb -sourcenode databasesource -srcauth zdmauth -srcarg1 user:opc -srcarg2 identity_file:/home/zdmuser/priv.key -srcarg3 sudo_location:/usr/bin/sudo -targetnode ociserverprimary -tgtauth zdmauth -tgtarg1 user:opc -tgtarg2 identity_file:/home/zdmuser/priv.key -tgtarg3 sudo_location:/usr/bin/sudo -targethome /u01/app/oracle/product/19.0.0.0/dbhome_1 -eval

Output:

enter image description here

Response file parameters will be used for the final migration.

enter image description here

Task 3: Instantiate the Final Migration Job

EVAL job status is success from Task 2 and the following command is used for starting the migration.

/u01/app/zdmhome/bin/zdmcli migrate database -rsp /home/zdmuser/physical_online.rsp -sourcedb DB0403_sourcedb -sourcenode databasesource -srcauth zdmauth -srcarg1 user:opc -srcarg2 identity_file:/home/zdmuser/priv.key -srcarg3 sudo_location:/usr/bin/sudo -targetnode ociserverprimary -tgtauth zdmauth -tgtarg1 user:opc -tgtarg2 identity_file:/home/zdmuser/priv.key -tgtarg3 sudo_location:/usr/bin/sudo -targethome /u01/app/oracle/product/19.0.0.0/dbhome_1 -pauseafter ZDM_CONFIGURE_DG_TGT

Added pauseafter flag to the migration command to pause the migration after the ZDM_CONFIGURE_DG_TGT phase. Now the job has successfully completed till the ZDM_CONFIGURE_DG_TGT phase and paused as expected.

Migration Results:

[zdmuser@workshop ~]$ zdmcli query job -jobid 13
workshop.pgvcnpublic1.pgvcn.oraclevcn.com: Audit ID: 115
Job ID: 13
User: zdmuser
Client: workshop
Job Type: "MIGRATE"
Scheduled job command: "zdmcli migrate database -rsp /home/zdmuser/physical_online.rsp -sourcedb DB0403_sourcedb -sourcenode databasesource -srcauth zdmauth -srcarg1 user:opc -srcarg2 identity_file:/home/zdmuser/priv.key -srcarg3 sudo_location:/usr/bin/sudo -targetnode ociserverprimary -tgtauth zdmauth -tgtarg1 user:opc -tgtarg2 identity_file:/home/zdmuser/priv.key -tgtarg3 sudo_location:/usr/bin/sudo -targethome /u01/app/oracle/product/19.0.0.0/dbhome_1"
Scheduled job execution start time: 2025-04-03T18:23:49Z. Equivalent local time: 2025-04-03 18:23:49
Current status: PAUSED
Current Phase: "ZDM_CONFIGURE_DG_TGT"
Result file path: "/u01/app/zdmbase/chkbase/scheduled/job-13-2025-04-03-18:23:55.log"
Metrics file path: "/u01/app/zdmbase/chkbase/scheduled/job-13-2025-04-03-18:23:55.json"
Job execution start time: 2025-04-03 18:23:55
Job execution end time: 2025-04-03 19:35:48
Job execution elapsed time: 41 minutes 7 seconds
ZDM_GET_SRC_INFO .............. COMPLETED
ZDM_GET_TGT_INFO .............. COMPLETED
ZDM_GET_STBY_INFO ............. COMPLETED
ZDM_PRECHECKS_SRC ............. COMPLETED
ZDM_PRECHECKS_TGT ............. COMPLETED
ZDM_PRECHECKS_STBY ............ COMPLETED
ZDM_SETUP_SRC ................. COMPLETED
ZDM_SETUP_TGT ................. COMPLETED
ZDM_SETUP_STBY ................ COMPLETED
ZDM_PREUSERACTIONS ............ COMPLETED
ZDM_PREUSERACTIONS_TGT ........ COMPLETED
ZDM_PREUSERACTIONS_STBY ....... COMPLETED
ZDM_VALIDATE_SRC .............. COMPLETED
ZDM_VALIDATE_TGT .............. COMPLETED
ZDM_VALIDATE_STBY ............. COMPLETED
ZDM_DISCOVER_SRC .............. COMPLETED
ZDM_COPYFILES ................. COMPLETED
ZDM_PREPARE_TGT ............... COMPLETED
ZDM_SETUP_TDE_TGT ............. COMPLETED
ZDM_RESTORE_TGT ............... COMPLETED
ZDM_RECOVER_TGT ............... COMPLETED
ZDM_FINALIZE_TGT .............. COMPLETED
ZDM_CONFIGURE_DG_SRC .......... COMPLETED
ZDM_COPYFILES_TGT_STBY ........ COMPLETED
ZDM_PREPARE_STBY .............. COMPLETED
ZDM_SETUP_TDE_STBY ............ COMPLETED
ZDM_RESTORE_TGT_STBY .......... COMPLETED
ZDM_RECOVER_TGT_STBY .......... COMPLETED
ZDM_FINALIZE_STBY ............. COMPLETED
ZDM_CONFIGURE_DG_TGT .......... COMPLETED
ZDM_SWITCHOVER_SRC ............ PENDING
ZDM_SWITCHOVER_TGT ............ PENDING
ZDM_POST_DATABASE_OPEN_TGT .... PENDING
ZDM_DATAPATCH_TGT ............. PENDING
ZDM_POST_MIGRATE_TGT_STBY ..... PENDING
ZDM_POST_MIGRATE_TGT .......... PENDING
ZDM_POSTUSERACTIONS ........... PENDING
ZDM_POSTUSERACTIONS_TGT ....... PENDING
ZDM_POSTUSERACTIONS_STBY ...... PENDING
ZDM_CLEANUP_SRC ............... PENDING
ZDM_CLEANUP_TGT ............... PENDING
ZDM_CLEANUP_STBY .............. PENDING

Pause After Phase: "ZDM_CONFIGURE_DG_TGT" <<<<<<<<<<<<<<<< job paused after this Phase.
[zdmuser@workshop ~]$

The migration job has been paused before the switchover step, The OCI future primary and future standby databases are changed to physical standby mode and Oracle Data Guard broker is configured by Oracle Zero Downtime Migration job with all three databases in the configuration and all are in sync.

enter image description here

Task 4: Start Migration Job Switchover Phase

Let us start the switchover by resuming Oracle Zero Downtime Migration job and the Task 3 job, which is 13.

[zdmuser@workshop ~]$ zdmcli resume job -jobid 13

workshop.pgvcnpublic1.pgvcn.oraclevcn.com: Audit ID: 117

The zdmcli query job -jobid 13 command gives the job status and the job is marked success now.

Output:

[zdmuser@workshop ~]$ zdmcli query job -jobid 13
workshop.pgvcnpublic1.pgvcn.oraclevcn.com: Audit ID: 121
Job ID: 13
User: zdmuser
Client: workshop
Job Type: "MIGRATE"
Scheduled job command: "zdmcli migrate database -rsp /home/zdmuser/physical_online.rsp -sourcedb DB0403_sourcedb -sourcenode databasesource -srcauth zdmauth -srcarg1 user:opc -srcarg2 identity_file:/home/zdmuser/priv.key -srcarg3 sudo_location:/usr/bin/sudo -targetnode ociserverprimary -tgtauth zdmauth -tgtarg1 user:opc -tgtarg2 identity_file:/home/zdmuser/priv.key -tgtarg3 sudo_location:/usr/bin/sudo -targethome /u01/app/oracle/product/19.0.0.0/dbhome_1"
Scheduled job execution start time: 2025-04-03T18:23:49Z. Equivalent local time: 2025-04-03 18:23:49

Current status: SUCCEEDED <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Result file path: "/u01/app/zdmbase/chkbase/scheduled/job-13-2025-04-03-18:23:55.log"
Metrics file path: "/u01/app/zdmbase/chkbase/scheduled/job-13-2025-04-03-18:23:55.json"
Job execution start time: 2025-04-03 18:23:55
Job execution end time: 2025-04-04 06:03:04
Job execution elapsed time: 56 minutes 15 seconds
ZDM_GET_SRC_INFO .............. COMPLETED
ZDM_GET_TGT_INFO .............. COMPLETED
ZDM_GET_STBY_INFO ............. COMPLETED
ZDM_PRECHECKS_SRC ............. COMPLETED
ZDM_PRECHECKS_TGT ............. COMPLETED
ZDM_PRECHECKS_STBY ............ COMPLETED
ZDM_SETUP_SRC ................. COMPLETED
ZDM_SETUP_TGT ................. COMPLETED
ZDM_SETUP_STBY ................ COMPLETED
ZDM_PREUSERACTIONS ............ COMPLETED
ZDM_PREUSERACTIONS_TGT ........ COMPLETED
ZDM_PREUSERACTIONS_STBY ....... COMPLETED
ZDM_VALIDATE_SRC .............. COMPLETED
ZDM_VALIDATE_TGT .............. COMPLETED
ZDM_VALIDATE_STBY ............. COMPLETED
ZDM_DISCOVER_SRC .............. COMPLETED
ZDM_COPYFILES ................. COMPLETED
ZDM_PREPARE_TGT ............... COMPLETED
ZDM_SETUP_TDE_TGT ............. COMPLETED
ZDM_RESTORE_TGT ............... COMPLETED
ZDM_RECOVER_TGT ............... COMPLETED
ZDM_FINALIZE_TGT .............. COMPLETED
ZDM_CONFIGURE_DG_SRC .......... COMPLETED
ZDM_COPYFILES_TGT_STBY ........ COMPLETED
ZDM_PREPARE_STBY .............. COMPLETED
ZDM_SETUP_TDE_STBY ............ COMPLETED
ZDM_RESTORE_TGT_STBY .......... COMPLETED
ZDM_RECOVER_TGT_STBY .......... COMPLETED
ZDM_FINALIZE_STBY ............. COMPLETED
ZDM_CONFIGURE_DG_TGT .......... COMPLETED
ZDM_SWITCHOVER_SRC ............ COMPLETED
ZDM_SWITCHOVER_TGT ............ COMPLETED
ZDM_POST_DATABASE_OPEN_TGT .... COMPLETED
ZDM_DATAPATCH_TGT ............. COMPLETED
ZDM_POST_MIGRATE_TGT_STBY ..... COMPLETED
ZDM_POST_MIGRATE_TGT .......... COMPLETED
ZDM_POSTUSERACTIONS ........... COMPLETED
ZDM_POSTUSERACTIONS_TGT ....... COMPLETED
ZDM_POSTUSERACTIONS_STBY ...... COMPLETED
ZDM_CLEANUP_SRC ............... COMPLETED
ZDM_CLEANUP_TGT ............... COMPLETED
ZDM_CLEANUP_STBY .............. COMPLETED
[zdmuser@workshop ~]$

The DGMGRL command is executed from target primary OCI (now it is current primary) as database switchover is performed. OCI target standby is still in Standby mode as expected and source changed from primary to physical standby role.

enter image description here

Despite the on-premises standby database not showing in the broker configuration, it keeps receiving the redo logs from OCI primary to source on-premises database and can be verified using log switches or log_archive_dest_3 value.

enter image description here

Task 5: Remove Source Database from Configuration

Remove the on-premises sync permanently and do the native switchover from the OCI Console.

enter image description here

Initiate switchover task from console to testing the console switchover.

enter image description here

  OCI Primary OCI standby
Before Switchover DB0403_primary_oci DB0403_69p_iad
After Switchover DB0403_69p_iad DB0403_primary_oci

The following image shows the DGMGRL output after switchover is complete.

enter image description here

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.