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.
Use Oracle Cloud Infrastructure Database Migration Service for real time data migration
Introduction
Oracle Cloud Infrastructure Database Migration (OCI Database Migration) is a fully managed service that provides a high performing,self-service experience for migrating databases to Oracle Cloud Infrastructure (OCI). Database Migration runs as a managed cloud service separated from your tenancy and resources. The service operates as a multitenant service in a OCI Database Migration service tenancy and communicates with your resources using Private Endpoints (PEs). PEs are managed by Database Migration. One of the biggest advantages of using OCI Database Migration is it eliminates complex infrastructure preparation. We only need to provide the connectivity between the source and the target databases via the OCI Database Migration service.
Objectives
This tutorial details the steps for OCI Database Migration service using with Oracle GoldenGate Marketplace for real time data migration from on-premises databases to OCI. It details how to migrate the Oracle 12c database hosted on the VM Instance (assuming this is our on-premises source database) to the OCI DB System 19c pluggable database instance (this is going to be our target database).
Source database: SASPRD, Version: 12.2.0.2 Target ATP: RAPPRD, Version: 19.17.0.0.0
Prerequisites
-
Source database is installed,configured and loaded with test data. For this tutorial, it is testlive schema which i am going to migrate.
-
Target database is provisioned with necessary schemas.
-
Vault and the Master Encryption Key are created under
cloud_eng_vault
. -
Oracle Object Storage Bucket is created (For this tutorial, Bucket name is datapump).
-
Port 443 port is required for communication and is added in the Security List.
Task 1: Configure Oracle GoldenGate Microservices for Data Replication
-
Log in to the OCI Console and navigate to the Marketplace.
-
Under All Applications, search for “Oracle GoldenGate for Oracle – Database Migrations” and select it.
-
Click Launch Stack to create the necessary resources, and then click Next.
-
Select your settings as shown in the following images.
-
Navigate to the Compute. Under Instances, you should be able to see the Oracle Golden Gate Microservices VM is created. Note the public IP of the server.
-
Using the web browser, load the Oracle GoldenGate Service Manager. If you get any connection timeout error, check ingress rule (443) in Security List.
-
The service Manager username is
oggadmin
. Log in to the Oracle GoldenGate server as the OPC User to get the password. You will find a JSON document –ogg-credentials.json
under the OPC home directory. Getoggadmin
user credential as below.
-bash-4.2$ cat /home/opc/ogg-credentials.json
{"username": "oggadmin", "credential": "***********"}
Before registering the source and target database with OCI Database Migration service, complete the following mandatory steps as described below.
Task 2: Prepare the Source Database for Migration
Database sasprd
-
Create GoldenGate User on the saspdb1 database.
CREATE USER c##ggadmin IDENTIFIED BY c##ggadmin_password DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp; ALTER USER c##ggadmin QUOTA 100M ON USERS; GRANT UNLIMITED TABLESPACE TO c##ggadmin; GRANT CONNECT, RESOURCE TO c##ggadmin container=all; GRANT SELECT ANY DICTIONARY TO C##GGADMIN container=all; GRANT CREATE VIEW TO C##GGADMIN container=all; GRANT EXECUTE ON dbms_lock TO c##ggadmin container=all; EXEC dbms_goldengate_auth.GRANT_ADMIN_PRIVILEGE('c##ggadmin',container=>'all'); On PDB SASPRD_PDB1
CREATE USER ggadmin IDENTIFIED BY ggadmin_password DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp; ALTER USER ggadmin QUOTA 800M ON USERS; GRANT UNLIMITED TABLESPACE TO ggadmin; GRANT CONNECT, RESOURCE TO ggadmin; GRANT SELECT ANY DICTIONARY TO GGADMIN; GRANT CREATE VIEW TO GGADMIN; GRANT EXECUTE ON dbms_lock TO ggadmin; EXEC dbms_goldengate_auth.GRANT_ADMIN_PRIVILEGE('ggadmin'); Set below parameters Alter system set global_names=false; alter system set STREAMS_POOL_SIZE=800m; Enable ARCHIVELOG if it is not already enabled. Enable supplemental logging. sql > SELECT supplemental_log_data_min, force_logging FROM v$database; sql > ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; sql > ALTER DATABASE FORCE LOGGING; Enable Golden Gate Replication sql > ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION=TRUE SCOPE=BOTH; Create database directory. This is the location where the dump files are created. sql > CREATE OR REPLACE DIRECTORY DATA_PUMP_DIR AS '/u01/app/oracle/product/datapump'; Preparing the Target Database for Migration: Database :-> rapprd Create GoldenGate User on the target database. In this tutorial, we have created ggadmin user in the PDB. You do not need to create any user in the container database for the target database.
CREATE USER ggadmin IDENTIFIED BY ggadmin_password DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
ALTER USER ggadmin QUOTA 100M ON USERS;
GRANT UNLIMITED TABLESPACE TO ggadmin;
GRANT CONNECT, RESOURCE TO ggadmin;
GRANT SELECT ANY DICTIONARY TO GGADMIN;
GRANT CREATE VIEW TO GGADMIN;
GRANT EXECUTE ON dbms_lock TO ggadmin;
EXEC dbms_goldengate_auth.GRANT_ADMIN_PRIVILEGE('ggadmin');
Set below parameters on
Alter system set global_names=false;
alter system set STREAMS_POOL_SIZE=300m;
Enable ARCHIVELOG if it is not already enabled.
Enable supplemental logging
Create database directory. This is the location where the dump files are stored.
sql > CREATE OR REPLACE DIRECTORY DATA_PUMP_DIR AS '/u01/app/oracle/product/datapump';
Now we are ready to register the source and the target databases with the OCI Database Migration service.
Task 3: Register the source and the target databases with the OCI Database Migration service
-
Navigate to Database Migration on the cloud console and click Registered Databases.
-
Click Register Database to register our first database.
-
Enter the source database details and click Next.
-
Connection String : Source server Host name/server IP address + Port + Service name.
-
-
Once all required details are completed, click Register.
-
Once your source database is added, you can proceed to the target database. Follow the same steps as we did for the source database. Change Connect String to reflect the target database IP address and PDB service name.
-
We should be able to see both source and target databases as Active.
-
-
We have completed registering our source and target databases with the OCI Database Migration service. Now we can create a migration job. Navigate to Migrations and click Create Migration.
-
Provide a name and click Next.
-
For Initial Load, select the option Data Pump via object storage and then select the bucket.
-
Select the Use Online Replication option, enter the GoldenGate hub details and click Create.
Task 4: Task Validation
-
Once the migration job is created, validate it before starting the actual migration. Click Validate to start the validation process.
- Validation goes in serval phases and if your configuration is all good, you should be able to see validation status green as shown in the following screen.
-
Once the Validation Phase is successfully completed, you can start the actual data migration job.
- Here we have options to pause after starting the replication. It is recommended to pause before switchover and do it after discussing with application team for having a planned activity. This is the actual cutover after which the changes cannot be reverted.
-
Finally, once the migration job is successfully completed and all steps are showing green status,then it is the time for application folks to validate their application data.
Related Links
Acknowledgments
- Author - Hakim Ahamad, Principal Cloud Architect
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.
Use Oracle Cloud Infrastructure Database Migration Service for real time data migration
F85990-01
August 2023
Copyright © 2023, Oracle and/or its affiliates.