3 Preparing for Database Migration
Before starting a Zero Downtime Migration database migration configure connectivity, prepare the database, and configure any required migration job customization.
See the Zero Downtime Migration Release Notes for the latest information about known issues, My Oracle Support notes, and runbooks.
- Configuring Connectivity Prerequisites
Connectivity must be set up between the Zero Downtime Migration service host and the source and target database servers. - Preparing the Database for Migration
Prepare the source and target databases for the migration. - Preparing for Automatic Application Switchover
To minimize or eliminate service interruptions on the application after you complete the database migration and switchover, prepare your application to automatically switch over connections from the source database to the target database. - Customizing a Migration Job
You can customize the Zero Downtime Migration workflow by registering action scripts or plug-ins as pre-actions or post-actions to be performed as part of the operational phases involved in your migration job.
Configuring Connectivity Prerequisites
Connectivity must be set up between the Zero Downtime Migration service host and the source and target database servers.
The following topics describe how to configure the Zero Downtime Migration connectivity prerequisites before running a migration job.
- Configuring Connectivity From the Zero Downtime Migration Service Host to the Source and Target Database Servers
Complete the following procedure to ensure the required connectivity between the Zero Downtime Migration service host and the source and target database servers. - Configuring Connectivity Between the Source and Target Database Servers
You can configure connectivity between the source and target database servers using one of two options. - Generating a Private SSH Key Without a Passphrase
If, on the Zero Downtime Migration service host, source database server, or target database server, the authentication key pairs are not available without a passphrase for the Zero Downtime Migration software installed user, you can generate a new SSH key using the following procedure. - Setting Up the Transparent Data Encryption Wallet
For Oracle Database 12c Release 2 and later, if the source database does not have TDE enabled, then it is mandatory that you configure the TDE wallet before migration begins. Enabling TDE on Oracle Database 11g Release 2 (11.2.0.4) and Oracle Database 12c Release 1 is not required.
Parent topic: Preparing for Database Migration
Configuring Connectivity From the Zero Downtime Migration Service Host to the Source and Target Database Servers
Complete the following procedure to ensure the required connectivity between the Zero Downtime Migration service host and the source and target database servers.
Parent topic: Configuring Connectivity Prerequisites
Configuring Connectivity Between the Source and Target Database Servers
You can configure connectivity between the source and target database servers using one of two options.
Option 1
The source database server specified in the ZDMCLI command -sourcenode
parameter can connect to target database instance over target SCAN through the
respecitve scan port and vice versa. The SCAN of the target should be resolvable from the
source database server, and the SCAN of the source should resolve from the target server.
Having connectivity from both sides, you can synchronize between the source database and
target database from either side. If the source database server SCAN cannot be resolved from
the target database server, then the SKIP_FALLBACK
parameter in the
response file must be set to TRUE
, and you cannot synchronize between the
target database and source database.
Option 2
If connectivity through SCAN and the SCAN port is not possible between the source and target database servers, set up an SSH tunnel from the source database server to the target database server using the procedure below. Using this option, you will not be able to synchronize between the target database and source database.
Note that this procedure amounts to setting up what may be considered a temporary channel. You can choose to set up access without using an SSH tunnel.
Note:
The following steps refer to Oracle Cloud Infrastructure, but are also applicable to Exadata Cloud at Customer and Exadata Cloud Service.Parent topic: Configuring Connectivity Prerequisites
Generating a Private SSH Key Without a Passphrase
If, on the Zero Downtime Migration service host, source database server, or target database server, the authentication key pairs are not available without a passphrase for the Zero Downtime Migration software installed user, you can generate a new SSH key using the following procedure.
SSH connectivity during Zero Downtime Migration operations requires direct, non-interactive access between the Zero Downtime Migration service host and the source and target database servers, and also between the source and target database servers, without the need to enter a passphrase.
Note:
The following steps show examples for generating a private SSH key for the software installed user. You can also use these steps for theopc
user.
Run the following command as the Zero Downtime Migration software installed user on the Zero Downtime Migration service host.
zdmuser> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/opc/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/opc/.ssh/id_rsa.
Your public key has been saved in /home/opc/.ssh/id_rsa.pub.
The key fingerprint is:
c7:ed:fa:2c:5b:bb:91:4b:73:93:c1:33:3f:23:3b:30 opc@rhost1
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| . . . |
| S o . = |
| . E . * |
| X.+o.|
| .= Bo.o|
| o+*o. |
+-----------------+
This command generates the id_rsa and id_rsa.pub files in the zdmuser home, for example, /home/zdmuser/.ssh.
You can add the public key (for example, /home/zdmuser/.ssh/id_rsa.pub) to the source and target database servers using the Oracle Cloud Infrastructure Console, or you can add it manually to the authorized_keys file on those servers, as shown below.
Add the contents of the Zero Downtime Migration service host /home/zdmuser/.ssh/id_rsa.pub file to the Oracle Cloud Infrastructure server opc user /home/opc/.ssh/authorized_keys file, as shown here.
[opc@rptest.ssh]$ export PS1='$PWD>'
/home/opc/.ssh>ls
authorized_keys authorized_keys.bkp id_rsa id_rsa.pub known_hosts zdmkey
/home/opc/.ssh>cat id_rsa.pub >> authorized_keys
You should save the private key in a separate, secure file, and use it to connect to the source and target database servers. For example, create a zdm_service_node.ppk file with permissions set to 600, and put the private key file into it on the Zero Downtime Migration service host software installed user home/.ssh to connect source and target database servers.
Parent topic: Configuring Connectivity Prerequisites
Setting Up the Transparent Data Encryption Wallet
For Oracle Database 12c Release 2 and later, if the source database does not have TDE enabled, then it is mandatory that you configure the TDE wallet before migration begins. Enabling TDE on Oracle Database 11g Release 2 (11.2.0.4) and Oracle Database 12c Release 1 is not required.
WALLET
status on both source and target databases
must be set to OPEN
, and the WALLET_TYPE
must be set to
AUTOLOGIN
.
Upon migration of your Oracle Database to the Oracle Cloud, bear in mind that Oracle databases in the Oracle Cloud are TDE enabled by default. Zero Downtime Migration will take care of the encryption of your target database, even if your source Oracle Database is not TDE enabled by default. However, once the switchover phase of the migration has taken place, the redo logs that the new primary database in the Oracle Cloud sends to the new standby database on your premises will be encrypted. Therefore, if you decide to switch back and role swap again making the on-premises database the primary again and the database in the Oracle Cloud the standby, the on-premises database will not be able to read the newly encrypted changed blocks applied by the redo logs unless TDE is enabled on-premises. In order to avoid post migration conflict, prior to performing the original switchover as part of the migration process, the recommended best practice is to perform appropriate testing and validation. There are options outside of Zero Downtime Migration for testing with a snapshot standby database, and once you are ready to proceed, delete the snapshot standby database and instruct Zero Downtime Migration to perform the switchover and finalize the migration process.
Parent topic: Configuring Connectivity Prerequisites
Preparing the Database for Migration
Prepare the source and target databases for the migration.
See the following topics for information about preparing the source and target databases for migration.
- Source Database Prerequisites
Meet the prerequisites on the source database before the Zero Downtime Migration process starts. - Target Database Prerequisites
The following prerequisites must be met on the target database before you begin the Zero Downtime Migration process. - Preparing for Migration to Oracle Cloud Infrastructure
Complete the following preparation before migrating data to an Oracle Cloud Infrastructure virtual machine or bare metal target. - Preparing for Migration to Exadata Cloud Service
Complete the following preparation before migrating data to an Exadata Cloud Service target. - Preparing for Migration to Exadata Cloud at Customer
Complete the following preparation before migrating data to an Exadata Cloud at Customer target. - Preparing for Offline Migration (Backup and Recovery)
Complete the following preparations before migrating a database to an Oracle Cloud Infrastructure, Exadata Cloud at Customer, or Exadata Cloud Service target environment.
Parent topic: Preparing for Database Migration
Source Database Prerequisites
Meet the prerequisites on the source database before the Zero Downtime Migration process starts.
Target Database Prerequisites
The following prerequisites must be met on the target database before you begin the Zero Downtime Migration process.
See Also:
Managing User Credentials for information about generating the auth token for Object Storage backups
Parent topic: Preparing the Database for Migration
Preparing for Migration to Oracle Cloud Infrastructure
Complete the following preparation before migrating data to an Oracle Cloud Infrastructure virtual machine or bare metal target.
Parent topic: Preparing the Database for Migration
Preparing for Migration to Exadata Cloud Service
Complete the following preparation before migrating data to an Exadata Cloud Service target.
Parent topic: Preparing the Database for Migration
Preparing for Migration to Exadata Cloud at Customer
Complete the following preparation before migrating data to an Exadata Cloud at Customer target.
- Preparing the Template for Exadata Cloud at Customer with Zero Data Loss Recovery Appliance Backup
When using Zero Data Loss Recovery Appliance as the backup medium for Zero Downtime Migration, set the parameters in the response file as described here. - Preparing a Template for Exadata Cloud at Customer with Object Storage Backup
When using Oracle Cloud Infrastructure Object Storage service as the backup medium for your Zero Downtime Migration, set the parameters in the response file as described here. - Preparing a Template for Exadata Cloud at Customer with NFS Backup
When using NFS storage as the backup medium for your Zero Downtime Migration, set the parameters in the response file as described here.
Parent topic: Preparing the Database for Migration
Preparing the Template for Exadata Cloud at Customer with Zero Data Loss Recovery Appliance Backup
When using Zero Data Loss Recovery Appliance as the backup medium for Zero Downtime Migration, set the parameters in the response file as described here.
- Set
TGT_DB_UNIQUE_NAME
to the target databasedb_unique_name
value. - Set
PLATFORM_TYPE
to ExaCC. - Set
MIGRATION_METHOD
to DG_ZDLRA, where DG stands for Data Guard and ZDLRA for Zero Data Loss Recovery Appliance. - Set the following Zero Data Loss Recovery Appliance parameters to use a backup residing in Zero Data Loss Recovery Appliance.
- Set
SRC_ZDLRA_WALLET_LOC
for the wallet location, for example,SRC_ZDLRA_WALLET_LOC=/u02/app/oracle/product/12.1.0/dbhome_3/dbs/zdlra
- Set
TGT_ZDLRA_WALLET_LOC
- Set
ZDLRA_CRED_ALIAS
for the wallet credential alias, for example,ZDLRA_CRED_ALIAS=zdlra_scan:listener_port/zdlra9:dedicated
- Set
- Specify the target database data files storage (ASM or ACFS) properties as
appropriate. For ASM set
TGT_DATADG
,TGT_REDODG
, andTGT_RECODG
. For ACFS setTGT_DATAACFS
,TGT_REDOACFS
, andTGT_RECOACFS
. - Set
SKIP_FALLBACK=TRUE
if you do not want to ship redo logs from the target to the source standby, either voluntarily or because there is no connectivity between the target and the source. - Set
SHUTDOWN_SRC=TRUE
, post migration, if you want to shut down the source database.
Parent topic: Preparing for Migration to Exadata Cloud at Customer
Preparing a Template for Exadata Cloud at Customer with Object Storage Backup
When using Oracle Cloud Infrastructure Object Storage service as the backup medium for your Zero Downtime Migration, set the parameters in the response file as described here.
- Set
TGT_DB_UNIQUE_NAME
to the target databasedb_unique_name
value. - Set
PLATFORM_TYPE
to ExaCC. - Set
MIGRATION_METHOD
to DG_OSS, where DG stands for Data Guard and OSS for the Object Storage service. - Specify the Oracle Cloud Infrastructure Object Storage service access and container details.
The source database is backed up to the specified container and restored to Exadata Cloud at Customer using RMAN SQL*Net connectivity.
- Specify the target database data files storage (ASM or ACFS) properties
as appropriate. For ASM set
TGT_DATADG
,TGT_REDODG
, andTGT_RECODG
. For ACFS setTGT_DATAACFS
,TGT_REDOACFS
, andTGT_RECOACFS
. - Set
SKIP_FALLBACK=TRUE
if you do not want to ship redo logs from the target to the source standby, either voluntarily or because there is no connectivity between the target and the source. - Set
SHUTDOWN_SRC=TRUE
, post migration, if you want to shut down the source database.
Parent topic: Preparing for Migration to Exadata Cloud at Customer
Preparing a Template for Exadata Cloud at Customer with NFS Backup
When using NFS storage as the backup medium for your Zero Downtime Migration, set the parameters in the response file as described here.
- Set
TGT_DB_UNIQUE_NAME
to the target databasedb_unique_name
value. - Set
PLATFORM_TYPE
to ExaCC. - Set
MIGRATION_METHOD
to DG_SHAREDPATH or DG_EXTBACKUP, where DG stands for Data Guard.Use
DG_STORAGEPATH
when a new backup needs to be taken and placed on an external storage mount (for eaxmple, an NFS mount point).Use
DG_EXTBACKUP
when using an existing backup, already placed on an external shared mount (for example, NFS storage).Note that if
MIGRATION_METHOD
is set to DG_EXTBACKUP then Zero Downtime Migration does not perform a new backup. - Set
BACKUP_PATH
to specify the actual NFS path which is made accessible from both the source and target database servers, for example, an NFS mount point. The NFS mount path should be same for both source and target database servers. This path does not need to be mounted on the Zero Downtime Migration service host.Note the following considerations:
- The source database is backed up to the specified path and restored to Exadata Cloud at Customer using RMAN SQL*Net connectivity.
- The path set in
BACKUP_PATH
should have ‘rwx’ permissions for the source database user, and at least read permissions for the target database user. - In the path specified by
BACKUP_PATH
, the Zero Downtime Migration backup procedure will create a directory, $BACKUP_PATH/dbname, and place the backup pieces in this directory.
- If you use
DG_EXTBACKUP
as theMIGRATION_METHOD
, then you should create a standby control file backup in the specified path and provide read permissions to the backup pieces for the target database user. For example,RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '< BACKUP_PATH >/lower_case_dbname/standby_ctl_%U';
Where standby_ctl_%U is a system-generated unique file name.
- Specify the target database data files storage (ASM or ACFS) properties
as appropriate. For ASM set
TGT_DATADG
,TGT_REDODG
, andTGT_RECODG
. For ACFS setTGT_DATAACFS
,TGT_REDOACFS
, andTGT_RECOACFS
. - Set
SKIP_FALLBACK=TRUE
if you do not want to ship redo logs from the target to the source standby, either voluntarily or because there is no connectivity between the target and the source. - Set
SHUTDOWN_SRC=TRUE
, post migration, if you want to shut down the source database.
Parent topic: Preparing for Migration to Exadata Cloud at Customer
Preparing for Offline Migration (Backup and Recovery)
Complete the following preparations before migrating a database to an Oracle Cloud Infrastructure, Exadata Cloud at Customer, or Exadata Cloud Service target environment.
Parent topic: Preparing the Database for Migration
Preparing for Automatic Application Switchover
To minimize or eliminate service interruptions on the application after you complete the database migration and switchover, prepare your application to automatically switch over connections from the source database to the target database.
In the following example connect string, the application connects to the source database, and when it is not available the connection is switched over to the target database.
(DESCRIPTION=
(FAILOVER=on)(LOAD_BALANCE=on)(CONNECT_TIMEOUT=3)(RETRY_COUNT=3)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=source_database_scan)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=target_database_scan)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=zdm_prod_svc)))
On the source database, create the service, named zdm_prod_svc in the examples.
srvctl add service -db clever -service zdm_prod_svc -role PRIMARY
-notification TRUE -session_state dynamic -failovertype transaction
-failovermethod basic -commit_outcome TRUE -failoverretry 30 -failoverdelay 10
-replay_init_time 900 -clbgoal SHORT -rlbgoal SERVICE_TIME -preferred clever1,clever2
-retention 3600 -verbose
See Also:
Oracle MAA white papers about client failover best practices on the Oracle Data Guard page at https://www.oracle.com/goto/maaHigh Availability in Oracle Database Development Guide
Parent topic: Preparing for Database Migration
Customizing a Migration Job
You can customize the Zero Downtime Migration workflow by registering action scripts or plug-ins as pre-actions or post-actions to be performed as part of the operational phases involved in your migration job.
The following topics describe how to customize a migration job.
- Registering Action Plug-ins
Custom plug-ins must be registered to the Zero Downtime Migration service host to be plugged in as customizations for a particular operational phase. - Creating an Action Template
After the useraction plug-ins are registered, you create an action template that combines a set of action plug-ins which can be associated with a migration job. - Updating Action Plug-ins
You can update action plug-ins registered with the Zero Downtime Migration service host. - Associating an Action Template with a Migration Job
When you run a migration job you can specify the image type that specifies the plug-ins to be run as part of your migration job.
Parent topic: Preparing for Database Migration
Registering Action Plug-ins
Custom plug-ins must be registered to the Zero Downtime Migration service host to be plugged in as customizations for a particular operational phase.
Determine the operational phase the given plug-in has to be associated with, and run the ZDMCLI command add useraction
, specifying -optype MIGRATE_DATABASE
and the respective phase of the operation, whether the plug-in is run -pre
or -post
relative to that phase, and any on-error requirements. You can register custom plug-ins for operational phases after ZDM_SETUP_TGT in the migration job workflow.
What happens at runtime if the useraction encounters an error can be specified with
the -onerror
option, which you can set to either
ABORT
, to end the process, or CONTINUE
, to continue
the migration job even if the custom plug-in exits with an error. See the example
command usage below.
Use the Zero Downtime Migration software installed user (for example, zmduser) to add
useractions to a database migration job. Adding useractions zdmvaltgt and zdmvalsrc with
the add useraction
command would look like the following.
zdmuser> ./zdmcli add useraction -useraction zdmvaltgt -optype MIGRATE_DATABASE
-phase ZDM_VALIDATE_TGT -pre -onerror ABORT -actionscript /home/useract.sh
zdmuser> ./zdmcli add useraction -useraction zdmvalsrc -optype MIGRATE_DATABASE
-phase ZDM_VALIDATE_SRC -pre -onerror CONTINUE -actionscript /home/useract1.sh
In the above command, the scripts /home/useract.sh and /home/useract1.sh are copied to the Zero Downtime Migration service host repository, and they are run if they are associated with any migration job run using an action template.
Parent topic: Customizing a Migration Job
Creating an Action Template
After the useraction plug-ins are registered, you create an action template that combines a set of action plug-ins which can be associated with a migration job.
An action template is created using the ZDMCLI command add
imagetype
, where the image type, imagetype
, is a bundle of all
of the useractions required for a specific type of database migration. Create an image
type that associates all of the useraction plug-ins needed for the migration of the
database. Once created, the image type can be reused for all migration operations for
which the same set of plug-ins are needed.
The base type for the image type created here must be CUSTOM_PLUGIN
, as shown in the example below.
For example, you can create an image type ACTION_ZDM
that bundles
both of the useractions created in the previous example, zdmvalsrc and zdmvaltgt.
zdmuser>./zdmcli add imagetype -imagetype ACTION_ZDM -basetype
CUSTOM_PLUGIN -useractions zdmvalsrc,zdmvaltgt
Parent topic: Customizing a Migration Job
Updating Action Plug-ins
You can update action plug-ins registered with the Zero Downtime Migration service host.
The following example shows you how to modify the useraction zdmvalsrc to be a
-post
action, instead of a -pre
action.
zdmuser>./zdmcli modify useraction -useraction zdmvalsrc -phase ZDM_VALIDATE_SRC
-optype MIGRATE_DATABASE -post
This change is propagated to all of the associated action templates, so you do not need to update the action templates.
Parent topic: Customizing a Migration Job
Associating an Action Template with a Migration Job
When you run a migration job you can specify the image type that specifies the plug-ins to be run as part of your migration job.
As an example, run the migration command specifying the action template ACTION_ZDM created in previous examples, -imagetype ACTION_ZDM
, including the image type results in running the useract.sh and useract1.sh scripts as part of the migration job workflow.
By default, the action plug-ins are run for the specified operational phase on all nodes of the cluster. If the access credential specified in the migration command option -tgtarg2
is unique for a specified target node, then an additional auth argument should be included to specify the auth credentials required to access the other cluster nodes. For example, specify -tgtarg2 nataddrfile:auth_file_with_node_and_identity_file_mapping
.
A typical nataddrfile for a 2 node cluster with node1 and node2 is shown here.
node1:node1:identity_file_path_available_on_zdmservice_node
node2:node2:identity_file_path_available_on_zdmservice_node
Parent topic: Customizing a Migration Job