13 Learn About Migrating a Database Cloud Service Deployment to a Virtual Machine Database System
If you want to migrate a single-instance database, created with Oracle Database Classic Cloud Service on an Oracle Cloud Infrastructure Compute Classic server, to an Oracle Cloud Infrastructure Virtual Machine Database System, then you can perform the database migration by using Oracle Data Guard.
This procedure can be used as part of an overall migration of your Oracle Cloud environment to Oracle Cloud Infrastructure.
Architecture
You can migrate Oracle Database releases 12.1.0.2 and 12.2.0.1. Before you migrate your database, you must have an Oracle Database Classic Cloud Service instance that you want to migrate, and an Oracle Cloud Infrastructure Server with Oracle Database installed.
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:
Description of the illustration architecture.png
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.
Note:
Oracle recommends using the same database name for both databases so that applications can automatically fall 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.
The roles that are described in this topic will be in the target database only if they were in the source database. Oracle Database creates these roles (as well as other roles) during the installation process to better enforce separation of duty.
The following table lists the roles that you will need to complete this Oracle Cloud Infrastructure solution.
Service Name: 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 the Database Migration
To plan the single instance of DBCS migration, you must inventory the source environment and decide on the best migration strategy.
Inventory the Source Environment
Inventorying the environment ensures that you have the supported Oracle Database versions and configurations that are required for migration.
-
Ensure that you have the supported versions and configurations. Here is the list of combinations that are supported by Oracle Data Guard for migration.
Database versions and configurations Source (Primary) Target (Standby) Database Service Oracle Database Classic Cloud Service (Standalone) Oracle Cloud Infrastructure Virtual Machine 1 Node Database System Database Version - 12.1.0.2
- 12.2.0.1
- 12.1.0.2
- 12.2.0.1
Database Storage Filesystem for : - 12.1.0.2
- 12.2.0.1
ASM for version 12.2.0.1 and version 12.1.0.2 databases
-
Determine the size of the source database .
You can view the source database size from the Oracle Database Classic Cloud Service service console. Identify the size of the OCPUs, Memory and Storage for the Oracle Database Classic Cloud Service instance. This information will enable you to identify the appropriate Oracle Cloud Infrastructure Virtual Machine Database shape which maps to the source database size. Virtual Machine Database system is available in fixed 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 your target database.
- 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.
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 primary database before starting the migration
- The best time of day to perform the migration
- Downtime requirements
- Database size
- Security considerations
- A strategy for large workloads
Prepare For Migration
To prepare for the migration of a single instance Oracle Database Classic Cloud Service to an Oracle Cloud Infrastructure server, you must perform multiple preparatory tasks before migration can start.
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 Virtual Machine Database system, in addition to the database that is currently on this system. An Oracle database on Virtual Machine Database system can accommodate multiple databases on a single host. The 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. The steps below provide the detailed process for creating the Oracle Cloud Infrastructure Virtual Machine Database system.
If you want to learn more about the Virtual Machine Database systems, you can refer to Oracle Cloud Infrastructure documentation.
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
- Login to your Oracle Cloud Services Dashboard
- Open the navigation menu. Under Services, click Database (NOT Database Classic).
- Choose your Compartment.
- Click Launch DB System.
- In the Launch DB System dialog, 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 1521 Is Open Between the Primary Database and the Standby Database
You must ensure that the primary database (the source database) and the standby database (the target database) can connect to each other through port 1521.
Ensure That Bundle Patches Have Been Applied and Are in Sync
You must ensure that the patch level on the primary database is earlier or the same as the patch level on the standby database.
The patches on the Oracle Database Classic Cloud Service instance (on Oracle Cloud Infrastructure Compute Classic) must be the same as the Oracle Cloud Infrastructure Virtual Machine Database System, and must be manually applied. Look out for one-off patches that have been applied to the primary database, and if there is a need to apply them to the standby database as well.
Compare Timezone Levels
The timezone of both the primary and standby database systems should be same. In case there is a difference, corresponding timezone patch to be applied. You can check for the timezone on both the systems, using the following command:
sudo su
su - oracle
sqlplus / as sysdba
SQL> select * from v$timezone_file;
FILENAME VERSION CON_ID
-------------------- ---------- ----------
timezlrg_28.dat 28 0
The output of the above command must be same on both primary and standby databases.
Migrate the Database
To perform the migration of a single instance Oracle Database Classic Cloud Service server to an Oracle Cloud Infrastructure Virtual Machine database system, you can use Oracle Data Guard. You must configure the database on Oracle Cloud Infrastructure Compute 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 Database 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.
Add Static Services to the Primary Database listener.ora
File
You must add a new static listener to the primary (source) database listener.ora
file and restart the listener.
Configure the Primary Database Parameters
After you configure the primary (source) database and add static services to the primary database listener.ora
file, you can configure the Oracle Data Guard parameters on the primary database.
Note:
Ensure that the source database is in ARCHIVELOG MODE with FLASHBACK enabled by default. It is recommended to have DB_BLOCK_CHECKSUM=FULL. If they are any performance issues then switch to DB_BLOCK_CHECKING=MEDIUMConfigure the Standby (Target) Database
To configure the standby (target) database, you must modify the
oratab,listener.ora,
and tnsnames.ora
files.
Drop Standby database
This step cleans up the initial database for creating a physical standby on Virtual Machine Database system.
Note:
Capture db_unique_name on standby database. It is mandatory to use same db_unique_name for standby database creation. The db_unique_name is case sensitive.- Use SSH to sign in to the standby database (the target database) server.
- At the command line, connect as
root
.sudo su -
- Sign in as the database software owner
oracle
.sudo su - oracle
- Stop the database
srvctl stop database -d <standby_db_unique_name>
- Start the database in mount mode
srvctl start database -d <standby_db_unique_name> -o mount
- Login to the database as user
sysdba
sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sat Feb 17 18:21:20 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c EE Extreme Perf Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options
- Drop the database
alter system enable restricted session; System altered. drop database;
Add Static Services to the Standby Database listener.ora File
After you add static services to the standby database (the target 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 clean-up tasks.
Move the spfile
File to Oracle Automatic Storage Management
You should move the spfile
file to Oracle Automatic Storage Management.
Change the init<target_db_name>.ora File to Reference the spfile File
You can modify the init<target_db_name>.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.
Clean Up the Standby Database
After you complete and test the migration, you can remove the Oracle Data Guard configuration from the standby database (the target database). You do not need to remove the original source database. At this stage, the standby database is the new source database.
Reapply Rolled Back Patches (if any) on Primary
After you complete the migration, you should reapply the patches(if any) that you had rolled back as part of the Prepare section. This step should be performed on primary database.
Note:
This step is applicable ONLY if you had applied patch for bug 18633374 in the Prepare step, and have rolled back any patches as part of that procedure.