15 Learn About Migrating a Multi-Node Database Cloud Service Deployment to Virtual Machine Database System
If you want to migrate a two-node Oracle Real Application Cluster (Oracle RAC) database created using Oracle Database Classic Cloud Service to an Oracle Cloud Infrastructure Virtual Machine Database System, then you can perform the database migration by using Oracle Data Guard.
For more information about the source and target databases, see the following table:
Information | Source Database | Target Database |
---|---|---|
Platform | Oracle Cloud Infrastructure Compute Classic | Oracle Cloud Infrastructure Compute |
Database Type | Oracle Real Application Cluster (RAC) Database on Database Classic Cloud Service Classic | Oracle RAC Database on Virtual Machine Database System |
Creation Mechanism | Database Classic Cloud Service UI, CLI, API | Oracle Cloud Infrastructure UI, CLI, API |
Size | 2 Node | 2 Node |
Architecture
You can migrate Oracle Database releases 12.1.0.2 and 12.2.0.1. Before you migrate your database, you must have Oracle RAC database on Oracle Database Classic Cloud Service and a two-node Oracle RAC Database running on Oracle Cloud Infrastructure.
When you use Oracle Data Guard to perform the migration, the source database is the primary database, and the target database is the standby database.
The following diagram shows the migration process:
To perform the migration, you must follow these general steps:
- Plan the migration.
When you plan the database migration, you begin by inventorying the source environment (the primary database) and then you decide on the best migration strategy. To inventory the source environment, you must perform tasks such as determining the sizes of database files and checking which disaster recovery plans are in place. To decide on the best strategy, you should plan, for example, the best time of day to perform the migration.
- Prepare for the migration.
To prepare to migrate the source database (the primary database) to the target environment (the standby database), you must perform tasks such as ensuring that the database that you want to migrate is running, installing the latest patches for both databases so that they are patched at the same level, and ensuring that the 1521 port is open between the primary database and the standby database. In this solution, the net service name for the source (primary) database is
OCIC-ORCL
and the net service name for the target (standby) database isOCI-ORCL
.Note:
Oracle recommends using the same database name for both databases so that applications can automatically fail over to the new database. - Perform the migration.
You can perform the database migration by configuring the primary database (the source database) and the standby database (the target database) for Oracle Data Guard, copying the TDE wallets from the primary database to the standby database, and then completing the standby database configuration.
Required Tools to Perform the Migration
Before you begin the database migration, in addition to knowledge of Oracle Cloud Infrastructure, you must have knowledge in several areas of Oracle Database tools.
The tools with which you must be familiar are as follows:
- SQL*Plus
- Oracle Data Guard
- Oracle Flashback Technology and
spfiles
- Familiarity with using the
srvctl
anddgmgrl
utilities - Familiarity with editing the
tnsnames.ora
,listener.ora
,sqlnet.ora
, andoraenv
files - Familiarity with performing Oracle Data Guard switchover operations
- (Optionally) Familiarity with generating Oracle Automatic Workload Repository and Oracle Automatic Database Diagnostic Monitor reports
- (Optionally) Familiarity with Oracle Automatic Storage Management Cluster File System (Oracle ACFS)
About Required Services and Roles
This solution requires Oracle Cloud Infrastructure.
Role | Required to... |
---|---|
Administrator (SYSDBA and
SYSOPER privileges)
|
Perform SYS -related administration
tasks.
|
Administrator (SYSDBG
privilege)
|
Perform Oracle Data Guard tasks, if you are using Oracle Database 12c release 2 (12.1.0.2) or later. |
Administrator (SYSKM privilege)
|
Perform Transparent Data Encryption tasks, if you are using Oracle Database 12c release 2 (12.1.0.2) or later. |
Plan
To plan the Oracle RAC database migration, you must inventory the source environment and decide on the best migration strategy.
Inventory the Source Environment
Inventorying the environment includes tasks such as ensuring that you have the supported Oracle Database versions and configurations.
-
Ensure that you have the supported versions and configurations.
At a minimum, you should have at least Oracle Database 12c release 1 (12.1.0.2) (standalone).
- Determine the size of the database files of the source
database.
You can find the total size of the database files of the database that you plan to migrate, including redo log files sizes, by executing the
du -s
command at the command line. For example:du -s /u01/app/oracle/*
This value provides information about how much space to allocate for the target database system. Check the name and sizes of data files by querying the
V$DATAFILE
andV$TEMPFILE
dynamic views. If you are using Oracle Automatic Storage Management, then check the data files used by ASM as well. - Determine the workload level.
You can generate an Oracle Automatic Workload Repository report to find a sample of the workload for the source database. Alternatively, if you have an Oracle Diagnostics Pack and Oracle Tuning Pack license, you can generate an Automatic Database Diagnostic Monitor report to find the source database performance over a period of time between specified snapshots. The time model statistics, operating system statistics, and wait events provide a relatively clear measure of the workload, in terms of the operating system capacity.
- Determine the environment variables that have been set in the source
database.
You may want to use these same settings in the target database.
- Check the database character
set.
You can find the database character set by issuing the following query:
SELECT * FROM NLS_DATABASE_PARAMETERS;
You will need to ensure that the target database will also have this character set.
- Determine the disaster recovery plan that is currently in place.
For example, if Oracle Data Guard is already deployed, then you can create a standby database for the migration procedure. (This migration solution will use Oracle Data Guard for the migration.) If off-site backups are used, then you should plan on making a new backup to ship to Oracle Cloud, using Oracle Recovery Manager (Oracle RMAN).
Decide on the Best Migration Strategy
After you inventory your environment, you should decide on the best migration strategy.
Consider the following before you begin the migration process:
- Take a backup of your current RAC database before starting the migration
- The best time of day to perform the migration
- Downtime requirements
- Database size
- The source database and the target database platform (endian)
- Security considerations
- A strategy for large workloads
Prepare Oracle RAC
To prepare for the migration of a Oracle Real Application Cluster (Oracle RAC) database to an Oracle Cloud Infrastructure server, you must perform multiple preparatory tasks before migration can start.
Add Entries for the Database Instances
Update the /etc/oratab
file on the Oracle RAC nodes and add an entry for your database instance as follows:
Ensure That the Database to be Migrated Is Running
Before you begin the migration process, you must check that the source database (the primary database) to be migrated is running.
Ensure That All Database Components on the Source Database Are Installed on the Target Database
You can find the components that are installed on the source database (the primary database) by querying the DBA_REGISTRY
data dictionary view.
Create a Standby Database for the Oracle Cloud Infrastructure System
You must create a standby database (the target database) on the Oracle Cloud Infrastructure, in addition to the database that is currently on this system. The creation process for creating this database creates a starter database during provisioning. Create the database system with the host name, shape, and CPU count that your site requires.
Generate SSH Key Pair
oracle
or the user
opc
. To access the standby Virtual Machine Database system, using
SSH, you have to use SSH key pair instead of a password to authenticate a remote user. A
key pair consists of a private key and public key. You keep the private key on your
computer and provide the public key every time you launch an instance. To create key
pairs, you can use a third-party tool such as OpenSSH on UNIX-style systems (including
Linux, Solaris, BSD, and OS X) or PuTTY Key Generator on Windows.
Create Virtual Cloud Network
When you work with Oracle Cloud Infrastructure, one of the first steps is to set up a virtual cloud network (VCN) for your cloud resources. Ensure that you have set up a VCN before creating a standby database. You can refer to Oracle Cloud Infrastructure documentation for more information on how to create a VCN.
Verify the Virtual Machine Database Shapes Supported by your Tenancy
When you sign up for Oracle Cloud Infrastructure, a set of service limits are configured for your tenancy. The service limit is the quota or allowance set on a resource. For example, your tenancy is allowed a maximum number of compute instances per availability domain. These limits are generally established with your Oracle account representative when you purchase Oracle Cloud Infrastructure.
When you create a standby Virtual Machine Database system, you have to ensure that the Virtual Machine database shape that you select, should closely map to the primary(source) instance. You also MUST ensure that the selected shape is supported by your tenancy.
Verify your tenancy limits and usage (by region):
Note:
If a given resource type has limits per availability domain, the limit and usage for each availability domain is displayed.- Open the Oracle Cloud Services Dashboard. Open the User menu and click Tenancy: <your_tenancy_name>.
- Click Service Limits on the left side of the page.
Your resource limits and usage for the specific region are displayed, broken out by service.
- Click on Database, and verify the Virtual Machine database shapes supported by your tenancy.
Your selection of the standby database shape should be a combination of shape that closely maps to primary(source) instance shape along with supported database shapes in your tenancy. Virtual Machine Database system is available in fixed data sizing shapes. Ensure that the shape chosen for creating database should be able to accommodate the source database plus any future sizing requirements. A thumb rule is to use a shape similar or higher in size than source database.
Create Standby Virtual Machine Database System
Note:
Ensure the database is created with the same parameters, such as character set, as the primary database (the source database).- Login to your Oracle Cloud Services Dashboard
- Open the navigation menu. Under Services, click Database (NOT Database Classic).
- Under Database, click Bare Metal, VM, and Exadata.
- Select the compartment in which you want to work.
- Click Launch DB System.
- In the Launch DB System wizard, enter the following:
- Click Launch DB System. The DB system appears in the list with a status of Provisioning. The DB system's icon changes from yellow to green (or red to indicate errors).
- Wait for the DB system's icon to turn green, with a status of Available, and then click the highlighted DB system name. Details about the DB system are displayed.
- Note the IP addresses; you'll need the private or public IP address, depending on network configuration, to connect to the DB system.
- Check the
SYS
password on the primary (source) database. If it does not meet the Oracle Cloud Infrastructure password requirements, then change it to match the password that you created for the standby database (the target database).
Ensure That Port 1522 and 1521 Is Open Between the Primary Database and the Standby Database
You must ensure that port 1522 is open on the primary database (the source database) and port 1521 on the standby database (the target database) to allow the databases to connect.
Enable Communication from the Oracle Cloud Infrastructure System to the Oracle Cloud Infrastructure Classic System
On the Oracle Cloud Infrastructure Classic system, you must open port 22 and 1522 for ingress traffic from the Oracle Cloud Infrastructure virtual machine system.
Enable Communication from the Oracle Cloud Infrastructure Classic System to the Oracle Cloud Infrastructure System
On the Oracle Cloud Infrastructure Database system, you must open ports 22 and 1521 for ingress traffic from the Oracle Cloud Infrastructure Classic system.
Ensure That Bundle Patches Have Been Applied and Are in Sync
Ensure that the patch level on the primary database (the source database) Oracle Cloud Infrastructure Classic system is earlier or the same as the patch level on the standby database (the target database) Oracle Cloud Infrastructure system.
Migrate Oracle RAC
To perform the migration of a Oracle RAC database from an Oracle Cloud Infrastructure Classic server to an Oracle Cloud Infrastructure Database system, you can use Oracle Data Guard. You must configure the database on Oracle Cloud Infrastructure Classic as the primary database (the source database), which you migrate to a standby database (the target database) on Oracle Cloud Infrastructure on virtual machine systems.
Configure the Primary (Source) Database
To configure the primary database (the source database), you configure Oracle
Data Guard and modify the listener.ora
and tnsnames.ora
files for the standby database (the target database).
Configure the Primary Database for the Standby Database
In this configuration, you configure the primary (source) database to use Oracle Data Guard.
Configure the Standby (Target) Database
To configure the standby (target) database, you must drop the standby database and
then modify the oratab
, listener.ora
, and
tnsnames.ora
files.
Add Entries for the Database Instances
Update the /etc/oratab
file on the Oracle RAC nodes and add an entry for your database instance as follows:
Add Static Services to the Standby Database listener.ora File
After you add static services to the standby database (the source database)
listener.ora
file, you must restart the listener. .
Copy TDE Wallets from the Primary Database to the Standby Database
You can manually copy the TDE wallet files from the primary database (the source database) system to the standby database (the target database) system by using Secure Copy Protocol (SCP).
Compress the TDE Wallet
You must perform this operation in the primary database (the source database).
Configure the Standby Initialization Parameter File and Start the Instance in NOMOUNT Mode
After you configure the standby initialization file, then you can restart the
database in NOMOUNT
mode.
Duplicate the Target Database for the Standby from the Active Database
You can execute a script to duplicate the standby database (the target database). If
the primary database (the source database) is large, then you can allocate
additional channels to improve its performance. For a newly installed database, one
channel typically runs the database duplication in a couple of minutes. Ensure that
no errors occur after you run the Oracle Recovery Manager (Oracle
RMAN
) duplication operation. If errors occur, then restart the database
by using the initialization parameter file (not spfile
), in case it
is generated under the $ORACLE_HOME/dbs
directory as part of the
Oracle RMAN
duplication process.
Post Oracle Recovery Manager Duplication Steps
After you complete the Oracle Recovery Manager (Oracle
RMAN
) duplication operation, you should perform these clean-up
tasks on the standby database (the target database).
Move the spfile File to Oracle Automatic Storage Management
You should move the spfile
file to Oracle Automatic Storage Management.
Change the inittarget_db_name.ora File to Reference the spfile File
You can modify the init<sid>.ora
file to reference the
spfile
file..
Modify and Start the Standby Database in MOUNT Mode
You can use the srvctl
to modify and start the standby database
(the target database).
Validate Oracle Data Guard Broker on the Primary Database and the Standby Database
You can use SQL*Plus to validate Oracle Data Guard Broker on the primary database (the source database) and the standby database (the target database).
Validate Oracle Data Guard Broker on the Primary Database
You can use SQL*Plus to validate Oracle Data Guard Broker on the primary database (the source database).
Perform the Migration
To complete the migration, you must perform a switchover operation from the primary database (the source database) to the standby database (the target database).
Post-Migration Steps
After you complete the migration of an Oracle database from an Oracle Cloud Infrastructure Compute Classic server to an Oracle Cloud Infrastructure server that uses a Virtual Machine Database system, you should validate the migration, and then remove the configuration from the primary database (the source database).
Test the Oracle Data Guard Configuration on the Standby Database
At this stage, the target database is now the primary database. The source database is now the standby database.
You can test the Oracle Data Guard connection on the target database, by performing a switchover operation with the source database. This switchover operation will make the target database take the standby role again. The purpose of this test is to prove that you can return to the original configuration in case the target database is not functional.