Replicate data from YugabyteDB to Autonomous AI Transaction Processing
Learn to replicate data from a YugabyteDB source to an Autonomous AI Transaction Processing target using OCI GoldenGate.
Before you begin
To successfully complete this quickstart, ensure you have:
-
A YugabyteDB installation to serve as the source database
-
An Autonomous AI Transaction Processing instance to serve as the target database.
Set up YugabyteDB
To set up your YugabyteDB instance:
-
If using Oracle Cloud Compute to host YugabyteDB, open port 5433:
sudo firewall-cmd --permanent --add-port=5432/tcp sudo firewall-cmd --reload sudo firewall-cmd --list-all -
Open port 5433 in your VCN's security list.
-
Run the following commands to set up the user. Ensure that you replace the
<password>placeholder with an actual password.create user ggadmin with password '<password>'; alter user ggadmin with SUPERUSER; GRANT ALL PRIVILEGES ON DATABASE ociggll TO ggadmin;
Environment set up: Autonomous AI Transaction Processing (ATP)
-
Download and unzip the sample database schema.
-
Unlock the GGADMIN user.
-
In the Oracle Cloud console, select your ATP instance from the Autonomous AI Databases page to view its details and access Database Actions.
-
Select Database Actions, and then select Database Users.
-
Locate GGADMIN, and then select its ellipsis menu (three dots) and select Edit.
-
In the Edit User panel, enter the GGADMIN password, confirm the password, and then deselect Account is Locked.
-
Select Apply Changes.
-
-
Load the target sample schema and data.
-
From the Database Actions menu, select SQL.
-
Copy and paste the script from OCIGGLL_OCIGGS_SETUP_USERS_ADW.sql into the SQL worksheet.
-
Select Run Script. The Script Output tab displays confirmation messages.
-
Clear the SQL worksheet and then copy and paste the SQL from OCIGGLL_OCIGGS_SRC_MIRROR_USER_SEED_DATA.sql.
-
To verify that the tables were created successfully, close the SQL window and reopen it again. In the Navigator tab, look for the SRC_OCIGGLL schema and then select tables from their respective dropdowns.
-
Task 1: Create the OCI GoldenGate resources
This quickstart example requires deployments and connections for both the source and target.
-
Create a deployment for the source PostgreSQL database.
-
Create a deployment for the target Autonomous AI Transaction Processing instance.
-
Create a connection to the source PostgreSQL database.
-
For Type, ensure that you select YugabyteDB.
-
For Database name, enter the YugabyteDB name.
-
For Host, enter the public IP of the Compute instance that YugabyteDB runs on.
-
For Port, enter
5433. -
For Username, enter
ggadmin. -
For Password, enter a password.
-
For Security Protocol, select Plain.
-
-
Create connection for the target Autonomous AI Transaction Processing instance.
-
Create a connection to GoldenGate, and then assign this connection to the source PostgreSQL deployment.
-
Assign the source connection to the source PostgreSQL deployment.
-
Assign the target connection to the target Oracle deployment.
Task 2: Enable supplemental logging
To enable supplemental logging:
-
Launch the PostgreSQL GoldenGate deployment console:
-
From the Deployments page, select the PostgreSQL deployment to view its details.
-
On the PostgreSQL deployment details page, select Launch console.
-
On the deployment console sign in page, enter the GoldenGate admin credentials provided in Task 1, step 1.
Note: Sign in is required if IAM wasn’t selected as the credential store when creating a deployment.
-
-
In the deployment console, select DB Connections in the left navigation, then the source PostgreSQL database, and then Trandata.
-
On the Trandata page, next to TRANDATA Information, select Add Trandata (plus icon).
-
In the Trandata panel, for Schema Name, enter
src_ociggll, and then select Submit.Note: Use the search field to search for
src_ocigglland verify the tables were added.
Task 3: Create the Extracts
-
Add the Change Data Capture Extract:
-
In the left navigation, select Extracts,
-
On the Extracts page, select Add Extract (plus icon), and then complete the fields as follows:
-
On the Extract Information page:
-
For Extract type, select Change Data Capture Extract.
-
For Process Name, enter a name for the Extract, such as
ECDC. -
Select Next.
-
-
On the Extract Options page:
-
For Source credentials, select Oracle GoldenGate from the Domain dropdown
-
Select the source PostgreSQL database from the Alias dropdown.
-
For Extract Trail Name, enter a two-character trail name, such as
C1. -
Select Next.
-
-
On the Extract Parameters page, replace
MAP *.*, TARGET *.*;with the following:TABLE SRC_OCIGGLL.*;
-
-
Select Create and Run.
-
-
Add the Initial Load Extract:
-
On the Extracts page, select Add Extract, and then complete the Add Extract form as follows:
-
On the Extract Information page:
-
For Extract type, select Initial Load Extract.
-
For Process Name, enter a name, such as
EIL. -
Select Next.
-
-
On the Extract Options page:
-
For Source credentials, select Oracle GoldenGate from the Domain dropdown.
-
Select the PostgreSQL database from the Alias, dropdown.
-
For Extract Trail Name, enter a two-character trail name, such as
I1. -
Select Next.
-
-
On the Extract Parameters page, replace the contents of the textarea with the following:
EXTRACT EIL USERIDALIAS PostgreSQL_Compute, DOMAIN OracleGoldenGate EXTFILE I1, PURGE TABLE src_ociggll.*;Note: Ensure that you remove the
SOURCEDBparameter in front ofUSERIDALIASbefore you move on.
-
-
Select Create and Run.
-
You return to the Extracts page, where you can observe the Extract starting.
Task 4: Create the Distribution Path for Initial Load Extract
-
On the deployment details page, select Launch Console, and then log in as the admin user.
-
If using IAM credential store, proceed to the Create a Distribution Path step. If using GoldenGate credential store, create a user with which the source GoldenGate uses to connect to the target GoldenGate.
-
In the navigation menu, select User Administration.
-
Select Add New User (plus icon), complete the fields as follows, and then select Submit:
-
For Username, enter
ggsnet. -
For Role, select Operator.
-
Enter the password twice for verification.
-
-
-
In the source PostgreSQL deployment console, create a Path Connection for the user created in the previous step.
-
In the navigation menu, select Path Connections.
-
Select Add Path Connection (plus icon), complete the fields as follows, and then select Submit:
-
For Credential Alias, enter
dpuser. -
For User ID, enter
ggsnet -
For Password, enter the same password used in the previous step.
-
-
-
Create a Distribution Path.
-
In the service menu bar, select Paths, and then select Add Distribution Path (plus icon).
-
Complete the Add Path form as follows:
-
On the Path Information page:
-
For Path Name, enter a name for this path.
-
Select Next.
-
-
On the Source Options page:
-
For Source Extract, leave blank.
-
For Trail Name, enter the Initial Load Extract trail name (
I1). -
Select Next.
-
-
On the Target Options page:
-
For Target, select wss.
-
For Target Host, enter the target deployment URL, without the https:// or any trailing slashes.
-
For Port Number, enter
443. -
For Trail Name, enter
I1. -
For Target Authentication Method, select UserID Alias.
-
For Domain, enter the domain name created in the previous step.
-
For Alias, enter the alias created in the previous step (
dpuser). -
Select Next.
-
-
-
Select Create and Run.
You return to the Distribution Service page where you can review the path created.
-
-
In the target deployment console, review the Receiver path created as a result of the Distribution path:
-
Select Paths.
-
Review the Path details.
-
Task 5: Add a Replicat for Initial Load
-
In the target Oracle deployment, add a Checkpoint table.
-
In the navigation menu, select DB Connections
-
Select the target Autonomous AI Database instance, and then Checkpoints.
-
On the Checkpoints page, select Add Checkpoint (plus icon).
-
In the Checkpoint panel, for Schema Table, enter
SRCMIRROR_OCIGGLL.CHECKTABLE. -
Select Submit.
-
-
Add the Replicat.
-
In the navigation menu, select Replicats.
-
On the Replicats page, select Add Replicat (plus icon), then complete the Add Replicat fields as follows:
-
On the Replicat Information page:
-
For Replicat type, select Nonintegrated Replicat.
-
For Process Name, enter a name, such as
RIL. -
Select Next
-
-
On the Replicat Options page:
-
For Replicat Trail Name, enter the name of the Trail from Task 2 (
I1). -
For Target Credentials, select the Domain and Alias for the Autonomous AI Database connection.
-
For Checkpoint Table, select the Checkpoint table you created in Step 1.
-
Select Next.
-
-
On the Parameter File page, replace
MAP *.*, TARGET *.*;with the following:MAP SRC_OCIGGLL.*, TARGET SRCMIRROR_OCIGGLL.*;
-
-
Select Create and Run.
You return to the Replicats page, where you can review the Replicat details.
-
-
Select the Replicat (RIL) and view its Details.
-
Select Statistics and review the number of Inserts. Refresh the page.
-
If the number of Inserts doesn't change, then all the records from the Initial Load have been loaded and you can stop the Replicat (RIL)
-
If the number of Inserts continues to increase, then keep refreshing the page until the Initial Load records are all loaded before continuing.
-
-
Verify the Initial Load.
-
In the Oracle Cloud console, on the Autonomous AI Database details page, select Database actions and then select SQL.
-
In the SQL tool, enter each of the following statements into the worksheet and select Run Statement:
SELECT * FROM SRCMIRROR_OCIGGLL.SRC_CITY; SELECT * FROM SRCMIRROR_OCIGGLL.SRC_CUSTOMER;
The output should return the data that was loaded into the target database tables as a result of the Initial Load.
-
Task 6: Create a Distribution Path for Change Data Capture Extract
-
In the source PostgreSQL deployment console, select Distribution Service.
-
Select Add Distribution Path.
-
Complete the Add Path form as follows:
-
On the Path Information page:
-
For Path Name, enter a name.
-
Select Next.
-
-
On the Source Options page:
-
For Source Extract, select the Change Data Capture Extract (
ECDC). -
For Trail Name, select the Change Data Capture trail file (
C1). -
Select Next.
-
-
On the Target Options page:
-
For Target, select wss.
-
For Target Host, enter the target deployment console URL (you can find this on the deployment details page, without the https:// or any trailing slashes).
-
For Port Number, enter
443. -
For Trail Name, enter
C1. -
For Target Authentication Method, select UserID Alias.
-
For Domain, enter the domain name.
-
For Alias, enter the alias.
-
-
Select Create Path and Run.
-
Task 7: Add a Replicat for Change Data Capture
-
In the target Oracle deployment console, add a Replicat.
-
In the Administration Service navigation menu, select Replicats.
-
On the Replicats page, select Add Replicat (plus icon), and then complete the Add Replicat form as follows:
-
On the Replicat Information page:
-
For Replicat type, select Nonintegrated Replicat.
-
For Process Name, enter a name, such as
RCDC. -
Select Next.
-
-
On the Replicat Options page:
-
For Replicat Trail Name, enter the name of the Trail from Task 3 (
C1). -
For Target Credentials, select the Domain and Alias for the Autonomous AI Database connection.
-
For Checkpoint Table, select the Checkpoint table.
-
-
On the Replicat Parameters page, replace
MAP *.*, TARGET *.*;with the following mapping:MAP SRC_OCIGGLL.*, TARGET SRCMIRROR_OCIGGLL.*;
-
-
Select Create. Do not run the Replicat.
-
-
On the Replicats page, select the Replicat for Initial Load (RIL) and view its Details.
-
Select Statistics and review the number of Inserts. Refresh the page.
-
If the number of Inserts doesn't change, then all the records from the Initial Load have been loaded and you can stop the Replicat (RIL)
-
If the number of Inserts continues to increase, then keep refreshing the page until theInitial Load records are all loaded before continuing.
Note: If you don’t see any Inserts, select Performance Metrics Service, select the Extract, and then select Database Statistics.
-
-
Return to the Replicats page and then start the Replicat for Change Data Capture (RCDC).
-
After starting the Replicat for Change Data Capture, review its Details and Statistics to view the number of Inserts.
-
Verify replication:
-
Run the following script to perform inserts into the PostgreSQL database:
Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1000,'Houston',20,743113); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1001,'Dallas',20,822416); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1002,'San Francisco',21,157574); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1003,'Los Angeles',21,743878); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1004,'San Diego',21,840689); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1005,'Chicago',23,616472); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1006,'Memphis',23,580075); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1007,'New York City',22,124434); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1008,'Boston',22,275581); Insert into src_ociggll.src_city (CITY_ID,CITY,REGION_ID,POPULATION) values (1009,'Washington D.C.',22,688002); -
In the source PostgreSQL deployment console, select the Change Data Capture Extract (
ECDC), and then select Statistics. Verify that src_ociggll.src_city has 10 inserts.Note: If the Extract captured no inserts, then restart the
ECDCExtract. -
In the target Oracle deployment console, select the Replicat name (
RCDC), view its Details, and then check Statistics. Verify thatSRCMIRROR_OCIGGLL.SRC_CITYhas 10 inserts.
-