Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
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
Oracle Zero Downtime Migration Workflow Steps
- Initiate database migration.
- Perform a restore from service.
- Instantiate standby database on the target primary.
- Synchronize primary and standby on the target primary.
- Perform restore from service.
- Instantiate standby database on the target standby.
- Synchronize source and target standbys.
- Monitor switchover readiness.
- Perform switchover and role transition.
- Configure target primary and restore cloud broker configuration.
- Oracle Zero Downtime Migration restores cloud broker configuration between cloud target primary and cloud target standby.
- Oracle Zero Downtime Migration configures the target primary to ship redo logs to the target standby.
- Perform post-validation checks.
- 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
-
Provision both target primary database and target standby database before beginning the migration process. These environments are assumed to be configured using Oracle Data Guard broker.
- When Exadata Cloud Service (ExaCS)/Oracle Exadata Database Service on Cloud@Customer is used for platform_type, this can be done using Oracle Data Guard Associations (in the Oracle Database Cloud Service console).
- For Virtual Machine Database System platform_type, the configuration can be done (manually) using Oracle Data Guard command-line interface (DGMGRL) which is a Oracle Data Guard broker CLI tool.
-
Supported migration methods: Only online migrations are supported (where Oracle Data Guard is used).
-
Supported data transfer methods: OCI Object Storage, Zero Data Loss Recovery Appliance (ZDLRA), Direct.
-
Supported platform type: ExaCS, Oracle Exadata Database Service on Cloud@Customer, Virtual Machine Database System (ZDLRA is not supported).
-
Generate public/private key pair and add the public keys to all 3 (source, target primary, target standby) servers. Copy the private key file on Oracle Zero Downtime Migration service host at accessible location. This file will be used during migration for login.
Task 1: Pre-Migration Tasks
The following steps explain the prerequisite tasks to complete before the actual migration.
-
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. -
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.
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.
-
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
-
Run the
tnsping
command to test the1521
port enabled between source and target primary servers and vice versa for log shipping. -
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. -
Updated the source server
/etc/hosts
file with the target primary and target standby information. -
Updated OCI future primary server
/etc/hosts
file with the entries shown in the following image. -
Updated OCI future standby server ` /etc/hosts` file with the entries shown in the following image.
-
Updated Oracle Zero Downtime Migration service host server
/etc/hosts
file with the entries shown in the following image.
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:
Response file parameters will be used for the final migration.
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.
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.
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.
Task 5: Remove Source Database from Configuration
Remove the on-premises sync permanently and do the native switchover from the OCI Console.
Initiate switchover task from console to testing the console switchover.
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.
Related Links
Acknowledgments
- Author - Sivakrishna Burle (Senior Cloud Engineer, Oracle North America Cloud Services - NACIE)
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.
Implement Oracle Zero Downtime Migration 21.5 Cloud Native Disaster Recovery Automation
G32182-01
Copyright ©2025, Oracle and/or its affiliates.