Replicate Data from Autonomous AI Transaction Processing to Azure Synapse Analytics
This quickstart demonstrates how to set up a data replication from Autonomous AI Transaction Processing to Azure Synapse Analytics using OCI GoldenGate.
Before you begin
To successfully complete this quickstart, you must have the following:
-
Azure Storage Container associated with Azure Synapse Analytics Workspace
-
Azure Synapse Analytics Database Scoped Credential to give permissions to SQL pool to access Storage Account
-
Target table existence: The target tables should exist on the Synapse database before replication. As GoldenGate uses Merge SQL Statement, the target table must be a hash distributed table.
-
OCI GoldenGate Azure Data Lake Storage connection assigned to deployment. If it doesn't exist, create an Azure Data Lake Storage connection and assign to deployment.
Environment set up: Autonomous AI Transaction Processing
If you don’t already have a source database set up for replication, you can follow these steps to load a sample schema to use for this quickstart. This quickstart uses Autonomous AI Transaction Processing for the source database.
To set up the source Autonomous AI Transaction Processing:
-
Download and unzip the sample database schema.
-
In the Oracle Cloud console, select your Autonomous AI Transaction Processing (ATP) instance from the Autonomous AI Databases page to view its details and access Database Actions.
-
Unlock the GGADMIN user:
-
Select Database actions, 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 source sample schema and data:
-
From the Database actions menu, under Development, select SQL.
-
Copy and paste the script from
OCIGGLL_OCIGGS_SETUP_USERS_ATP.sqlinto the SQL worksheet. -
Select Run Script. The Script Output tab displays confirmation messages.
-
Clear the SQL worksheet and then copy and paste the SQL script from
OCIGGLL_OCIGGS_SRC_USER_SEED_DATA.sql.Tip: You may need to run each statement separately for the SQL tool to execute the scripts successfully.
-
To verify that the tables were created successfully, close the SQL window and reopen it again. In the Navigator tab, look for the
SRC_OCIGGLLschema and then select tables from their respective dropdowns.
-
-
Enable supplemental logging:
-
Clear the SQL Worksheet.
-
Enter the following statement, and then select Run Statement:
ALTER PLUGGABLE DATABASE ADD SUPPLEMENTAL LOG DATA;
-
Environment setup: Azure Synapse Analytics
-
Open Azure Synapse Analytics Workspace.
-
Select New, and then SQL Script.
-
Connect to your sql pool and select your database.
-
Enter the following command to create a Master Key Encryption:
CREATE MASTER KEY ENCRYPTION BY PASSWORD='<password>'; -
Use the following command to create Database Scoped Credential:
Ensure that you replace the
<storage-account-name>and<storage-account-access-key>placeholders with their actual values.CREATE DATABASE SCOPED CREDENTIAL <credential name> WITH IDENTITY='<storage-account-name>', SECRET='<storage-account-access-key>'; -
Run the create table script:
CREATE TABLE [dbo].[SRC_CUSTOMER] ( CUSTID NUMERIC(10) NOTNULL, DEAR NUMERIC(1), LAST_NAME VARCHAR(50), FIRST_NAME VARCHAR(50), ADDRESS VARCHAR(100), CITY_ID NUMERIC(10), PHONE VARCHAR(50), AGE NUMERIC(3), SALES_PERS_ID NUMERIC(10), constraint PK_SRC_CUSTOMER primarykeyNONCLUSTERED (CUSTID) NOT ENFORCED ) WITH(DISTRIBUTION=HASH ([CUSTID]), HEAP ) GO -
Verify that the
dbo.SRC_Customertable is created.
Task 1: Create the OCI GoldenGate resources
This quickstart example requires deployments and connections for both the source and target.
-
Create an Oracle deployment for the source Autonomous AI Transaction Processing instance.
-
Create a Big Data deployment for the target Azure Synapse Analytics.
-
Create a connection to the source Autonomous AI Transaction Processing.
-
Assign the Autonomous AI Transaction Processing connection to the source Oracle deployment.
-
Assign Azure Synapse Analytics connection to the target Big Data deployment.
Task 2: Add the Extract
-
On the Deployments page, select the source Autonomous AI Transaction Processing deployment.
-
On the deployment details page, select Launch Console.
-
Log in with the source deployment's administrator username and password.
Task 3: Add and run the Distribution Path
-
If using GoldenGate credential store, create a user for the Distribution Path in the target Big Data deployment, otherwise skip to Step 3.
-
In the source GoldenGate deployment console, add a Path Connection for the user created in Step 1.
-
In the source GoldenGate deployment console, select Path Connections in the left navigation.
-
Select Add Path Connection (plus icon), and then complete the following:
-
For Credential Alias, enter
GGSNetwork. -
For User ID, enter the name of the user created in Step 1.
-
Enter the user's password twice for verification.
-
-
Select Submit.
The path connection appears in the Path Connections list.
-
-
In the source deployment console, add a Distribution Path with the following values:
-
On the Source Options page:
-
For Source Extract, select the Extract created in Task 2.
-
For Trail Name, enter a two-character name, such as
E1.
-
-
On the Target Options page:
-
For Target Host, enter the host domain of the target deployment.
-
For Port Number, enter
443. -
For Trail Name, enter a two-character name, such as
E1. -
For Alias, enter the Credential Alias created in Step 2.
-
-
-
In the target Big Data deployment console, review the Receiver Path created as a result of the Distribution Path.
-
In the target Big Data deployment console, select Receiver Service.
-
Review the path details. This path was created as a result of the Distribution Path created in the previous step.
-
Task 4: Add and run the Replicat
-
In the target Big Data deployment console, select Replicats, and then select Add Replicat (plus icon).
-
Add a Replicat with the following values:
-
On the Replicat Information page, under Replicat type, select Classic Replicat, enter a Process Name, and then select Next.
-
On the Replication Options page:
-
For Name, enter the name of the Trail from Task 2.
-
For Domain, select a domain.
-
For Alias, select the Azure Synapse Analytics connection created in Task 1.
-
For Checkpoint Table, select the checkpoint table you created for the target deployment.
-
-
On the Replicat Parameters page, replace
MAP *.*, TARGET *.*;with:MAP SRC_OCIGGLL.SRC_CUSTOMER, TARGET dbo.SRC_CUSTOMER; -
On the Replicat Properties page, configure Azure Synapse Analytics properties:
Note: Edit the properties marked as
TODO.-
gg.eventhandler.abs.bucketMappingTemplateis the Azure Storage Container associated with the Azure Synapse Analytics Workspace -
gg.eventhandler.synapse.credentialis the name of the credential used to authenticate Azure Storage Container associated with the Azure Synapse Analytics Workspace
-
-
-
Select Create and Run.
You’re returned to the Overview page, where you can review the Replicat details.
Task 5: Verify the replication
Perform some updates to the source Autonomous AI Transaction Processing instance to verify replication to Azure Data Lake Storage.
-
In the Oracle Cloud console, open the navigation menu, select Oracle AI Database, and then select Autonomous AI Transaction Processing.
-
In the list of Autonomous AI Transaction Processing instances, select your source instance to view its details.
-
On the database details page, select Database Actions.
Note: You should be automatically logged in. If not, log in with the database credentials.
-
On the Database Actions home page, select SQL.
-
Enter the following into the worksheet and select Run Script.
-
In the source GoldenGate OCI GoldenGate deployment console, select the Extract name, and then select Statistics. Verify that SRC_OCIGGLL.SRC_CUSTOMER has 7 inserts.
Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1001,0,'Brendt','Paul','10 Jasper Blvd.',107,'(212) 555 2146',19,10); Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1002,0,'McCarthy','Robin','27 Pasadena Drive',11,'(214) 555 3075',29,11); Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1003,0,'Travis','Peter','7835 Hartford Drive',12,'(510) 555 4448',34,12); Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1004,0,'Larson','Joe','87 Carmel Blvd.',13,'(213) 555 5095',45,13); Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1005,0,'Goldschmidt','Tony','91 Torre drive',14,'(619) 555 6529',55,20); Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1006,0,'Baker','William','2890 Grant Avenue',15,'(312) 555 7040',64,21); Insert into SRC_OCIGGLL.SRC_CUSTOMER (CUSTID,DEAR,LAST_NAME,FIRST_NAME,ADDRESS,CITY_ID,PHONE,AGE,SALES_PERS_ID) values (1007,0,'Swenson','Jack','64 Imagination Drive',19,'(202) 555 8125',74,22) -
In the target Big Data OCI GoldenGate deployment console, select the Replicat name, and then select Statistics. Verify that SRC_OCIGGLL.SRC_CUSTOMER has 7 inserts.
-
In Azure console, navigate to Azure Synapse Analytics workspace Console. Run Select * from dbo.SRC_CUSTOMER and verify that SRC_OCIGGLL.SRC_CUSTOMER has 7 inserts.