4 Migrating Your Database with Zero Downtime Migration
Evaluate the database migration job, run the job, and perform other operations during and after a database migration.
See the Zero Downtime Migration Release Notes for the latest information about known issues, My Oracle Support notes, and runbooks.
- Migrate the Database
 Perform the database migration with Zero Downtime Migration using the following procedure.
- Query Migration Job Status
 You can query the migration job status while the job is running.
- List Migration Job Phases
 You can list the operation phases involved in the migration job.
- Pause and Resume a Migration Job
 You can pause a migration job at any point after theZDM_SETUP_TGTphase, and resume the job at any time.
- Rerun a Migration Job
 If there are any unexpected errors in the migration workflow, you can correct them and rerun the migration job.
- Terminate a Running Migration Job
 If you want to resubmit a database migration job for a specified database, you must first terminate the running migration job.
- Post-Migration Tasks
 The following topics describe tasks that you do after you complete the database migration job.
Migrate the Database
Perform the database migration with Zero Downtime Migration using the following procedure.
Parent topic: Migrating Your Database with Zero Downtime Migration
Query Migration Job Status
You can query the migration job status while the job is running.
Query the status of a database migration job using the ZDMCLI query job command, specifying the job ID. The job ID is shown in the command output when the database migration job is submitted.
                  
zdmuser> $ZDM_HOME/bin/zdmcli query job -jobid job-idYou can find the console output of the migration job in the file indicated (Result file
            path:) in the query job command output. You can see migration progress
            messages in the specified file
                  
Parent topic: Migrating Your Database with Zero Downtime Migration
List Migration Job Phases
You can list the operation phases involved in the migration job.
To list the operation phases involved in the migration job, add the -listphases option in the ZDMCLI migrate command. This option will list the phases involved in the operation.
                  
For example,
zdmuser> $ZDM_HOME/bin/zdmcli migrate database -sourcedb zdmsdb -sourcenode ocicdb1 -srcauth zdmauth
-srcarg1 user:opc -srcarg2 identity_file:/home/zdmuser/.ssh/zdm_service_host.ppk -srcarg3 sudo_location:/usr/bin/sudo
-targetnode ocidb1 -backupuser backup_user@example.com -rsp /u01/app/zdmhome/rhp/zdm/template/zdm_template_zdmsdb.rsp
-tgtauth zdmauth -tgtarg1 user:opc -tgtarg2 identity_file:/home/zdmuser/.ssh/zdm_service_host.ppk
-tgtarg3 sudo_location:/usr/bin/sudo -listphasesParent topic: Migrating Your Database with Zero Downtime Migration
Pause and Resume a Migration Job
You can pause a migration job at any point after the
                        ZDM_SETUP_TGT phase, and resume the job at any
                time.
                  
To pause a migration job, specify the –pauseafter option in the
                                ZDMCLI
                     migrate command with a valid phase to be paused after.
                  
In the following example, if you specify -pauseafter
                                ZDM_SETUP_TGT, the migration job will pause after
                        completing the ZDM_SETUP_TGT phase.
                  
zdmuser> $ZDM_HOME/bin/zdmcli migrate database -sourcedb zdmsdb -sourcenode ocicdb1
-srcauth zdmauth -srcarg1 user:opc
-srcarg2 identity_file:/home/zdmuser/.ssh/zdm_service_host.ppk
-srcarg3 sudo_location:/usr/bin/sudo -targetnode ocidb1 
-backupuser backup_user@example.com -rsp /u01/app/zdmhome/rhp/zdm/template/zdm_template_zdmsdb.rsp -tgtauth zdmauth 
-tgtarg1 user:opc -tgtarg2 identity_file:/home/zdmuser/.ssh/zdm_service_host.ppk
-tgtarg3 sudo_location:/usr/bin/sudo -pauseafter ZDM_SETUP_TGTChoosing a Migration Job Phase to Pause After
Choose a valid phase that is listed in the migrate database
                                ... -listphases command output.
                  
Note that the -pauseafter option allows only one
                        phase to be specified.
                  
Pausing the migration job after ZDM_SETUP_TGT is recommended.
                  
If you use -pauseafter at phase
                                ZDM_CONFIGURE_DG_SRC, then at the end of the
                        execution of the phase, a standby is created at the target database and
                        synchronization occurs between source and target databases.
                  
Preserving Log Files During a Paused Migration Job
To prevent source and target database log files from getting cleaned
                        up between pausing and resuming a migration job, log files are written to
                                        $ORACLE_BASE/zdm/zdm_db_unique_name_zdm_job_id/zdm/log in their respective
                        source and target database servers.
                  
Resuming a Migration Job
A paused job can be resumed any time by running the ZDMCLI
                     resume job command, specifying the respective job ID.
                  
zdmuser> $ZDM_HOME/bin/zdmcli resume job -jobid Job_ID 
[-pauseafter valid-phase]To schedule another pause, specify the –pauseafter
                        option in the resume command with a valid phase to be
                        paused after. Choose a valid phase later than phase currently paused at,
                        that is listed in the migrate database ... -listphases
                        command output.
                  
Parent topic: Migrating Your Database with Zero Downtime Migration
Rerun a Migration Job
If there are any unexpected errors in the migration workflow, you can correct them and rerun the migration job.
The errors are recorded in the job output, which can be queried using the ZDMCLI query job command. Upon resolving the error, the failed job can be continued from the point of failure.
                  
Rerun the migration job by running the ZDMCLI resume job command, specifying the job ID of the job to be rerun, as shown here.
                  
zdmuser> $ZDM_HOME/bin/zdmcli resume job -jobid Job_IDParent topic: Migrating Your Database with Zero Downtime Migration
Terminate a Running Migration Job
If you want to resubmit a database migration job for a specified database, you must first terminate the running migration job.
Zero Downtime Migration blocks attempts to rerun the MIGRATE
                    DATABASE command for a specified database if that database is already
                part of an ongoing migration job.
                     
If you want to resubmit a database migration job for a specified
                database, you must first terminate the running migration job in either
                    EXECUTING or PAUSED state using the
                    ZDMCLI ABORT JOB command.
                     
zdmuser> $ZDM_HOME/bin/zdmcli abort job -jobid job-idParent topic: Migrating Your Database with Zero Downtime Migration
Post-Migration Tasks
The following topics describe tasks that you do after you complete the database migration job.
- Run Datapatch on the Target Database
 If the target database environment is at a higher patch level than the source database, you must run the datapatch utility on the target database. Skip this task if you setTGT_SKIP_DATAPATCH=FALSEin the response file and datapatch was run as part of the migration job.
Parent topic: Migrating Your Database with Zero Downtime Migration
Run Datapatch on the Target Database
If the target database environment is at a higher patch level than the source
        database, you must run the datapatch utility on the target database. Skip this task if you
        set TGT_SKIP_DATAPATCH=FALSE in the response file and datapatch was run as
        part of the migration job.
                     
For example, if your source database is at Jan 2020 PSU/BP and the target is at April 2020 PSU/BP), you must run the datapatch utility. Before running datapatch on the target, ensure you apply the target patch level to the binaries at the source (standby) database.
Parent topic: Post-Migration Tasks