Amazon RDS for Oracle is a fully managed database service provided by AWS that allows you to leverage the power and flexibility of Oracle databases in the cloud. This reduces the burden of managing these databases yourself and enables you to easily scale its resources up or down as per your requirements. Amazon RDS helps you reduce costs while providing enhanced security, improved performance, and simplified database management.
Refer to Oracle on Amazon RDS for the supported Oracle database versions.
Prerequisites
Perform the following steps to configure your Amazon RDS Oracle Source:
Create a Database User and Grant Privileges
1. Create a database user (optional)
You must have the CREATE
privilege to perform this step.
To create a user, connect to your Oracle server in SQL Developer or any SQL client tool as a root user and enter the following command:
CREATE USER <username> IDENTIFIED BY <password>;
Note: Replace the placeholder values in the command above with your own. For example, <username> with jacobs.
2. Grant privileges to the user
The database user that you specify in the Hevo Pipeline must have SELECT
privileges. To assign this privilege, connect to your Oracle server in SQL Developer or any SQL client tool as a root user and enter the following commands:
-
(Optional) Check current privileges assigned to the database user:
SELECT * FROM DBA_TAB_PRIVS WHERE GRANTEE = '<username>';
The above command returns a table with the PRIVILEGE column specifying the privileges and the tables on which they are granted.
-
Grant access to query data dictionary views and create and alter session settings:
GRANT SELECT ANY DICTIONARY to <username>;
GRANT CONNECT, CREATE, ALTER SESSION TO <username>;
This allows the database user to retrieve information about the database structure and metadata.
-
Grant access to the user to select data from all views accessible to them in the database:
BEGIN
rdsadmin.rdsadmin_util.grant_sys_object('ALL_VIEWS','<USERNAME>','SELECT');
END;
Note: In the command above, the <USERNAME> must be in capital letters.
-
Do one of the following:
Note: Replace the placeholder values in the commands above with your own. For example, <schema_name> with sales.
Set up Redo Logs for Replication
A redo log is a collection of log files that record information about modifications made to data objects on an Oracle server instance. Oracle LogMiner uses redo logs to track these modifications and determine the rows requiring updates in the Destination system.
Connect to your Oracle server as a user with SYSDBA privileges using SQL Developer or any other SQL client tool and perform the following steps:
1. Enable Archive log
Archive logs are essential for the backup and recovery processes of a database management system, especially in systems that use the transactional or logging approach to maintain data integrity. Before enabling this, verify if the current archiving mode of the database is ARCHIVELOG
:
SELECT LOG_MODE FROM V$DATABASE;
This query returns either of the following values:
If the result of the above query is NOARCHIVELOG
, enable archive log using the following commands:
BEGIN
rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours', 72);
END;
Note: The minimum value for archivelog retention hours
is 72. The archive log retention must be 72 hours at a minimum. This avoids any data loss that may occur due to downtimes in the Source database.
2. Enable supplemental logging
Supplemental logging ensures that columns are logged in Redo log files, which is essential for LogMiner to access the activity history of a database.
Before enabling supplemental logging, check if it is already enabled:
SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM "V$DATABASE";
This returns either of the following values:
-
YES
: This represents that supplemental logging is enabled.
-
IMPLICIT
: Indicates that supplemental logging is automatically enabled by the database based on certain conditions or configurations.
-
NO
: This represents that supplemental logging is disabled.
If the result of the above query is NO, enable supplemental logging at the database level:
BEGIN
rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD','ALL');
END;
3. Grant permissions to run LogMiner
The database user you created above must have SELECT
privileges on LogMiner views and EXECUTE
privileges on LogMiner packages. This ensures that the user can effectively analyze, mine redo log files, gaining valuable insights into database changes.
To grant these privileges, enter the following commands:
BEGIN
rdsadmin.rdsadmin_util.grant_sys_object('V_$DATABASE', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR','<USERNAME>','EXECUTE');
rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR_D','<USERNAME>','EXECUTE');
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG_HISTORY', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_LOGS', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_CONTENTS', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_PARAMETERS', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGFILE', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVED_LOG', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVE_DEST', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$TRANSACTION', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$MYSTAT', '<USERNAME>','SELECT');
rdsadmin.rdsadmin_util.grant_sys_object('V_$STATNAME', '<USERNAME>','SELECT');
END;
Note: Replace the placeholder values in the commands above with your own. For example, <USERNAME> with JACOBS.
Refer to the table below for more information about these commands:
Command |
Allows Hevo to |
rdsadmin.rdsadmin_util.grant_sys_object('V_$DATABASE', '<USERNAME>','SELECT'); |
Read data from the V_$DATABASE table . |
rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR','<USERNAME>','EXECUTE'); |
Execute procedures and functions available in the DBMS_LOGMNR package. |
rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR_D','<USERNAME>','EXECUTE'); |
Execute procedures and functions available in the DBMS_LOGMNR_D package. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG', '<USERNAME>','SELECT'); |
Query data from the V_$LOG view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG_HISTORY', '<USERNAME>','SELECT'); |
Query data from the V_$LOG_HISTORY view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_LOGS', '<USERNAME>','SELECT'); |
Query data from the V_$LOGMNR_LOGS view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_CONTENTS', '<USERNAME>','SELECT'); |
Query data from the V_$LOGMNR_CONTENTS view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_PARAMETERS', '<USERNAME>','SELECT'); |
Query data from the V_$LOGMNR_PARAMETERS view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGFILE', '<USERNAME>','SELECT'); |
Query data from the V_$LOGFILE view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVED_LOG', '<USERNAME>','SELECT'); |
Query data from the V_$ARCHIVED_LOG view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVE_DEST', '<USERNAME>','SELECT'); |
Query data from the V_$ARCHIVE_DEST view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$TRANSACTION', '<USERNAME>','SELECT'); |
Query data from the V_$TRANSACTION view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$MYSTAT', '<USERNAME>','SELECT'); |
Query data from the V_$MYSTAT view in the database. |
rdsadmin.rdsadmin_util.grant_sys_object('V_$STATNAME', '<USERNAME>','SELECT'); |
Query data from the V_$STATNAME view in the database. |
Allowlist Hevo’s IP Addresses
You need to allowlist the Hevo IP address for your region to enable Hevo to connect to your Amazon RDS Oracle database. You can do this by creating a VPC security group and adding inbound and outbound access rules for the Hevo IP addresses. A VPC group controls access to the database instances and virtual server instances inside a VPC.
To do this:
1. Create a VPC security group
-
Access the Amazon RDS console.
-
In the left navigation pane, under Dashboard, select Databases (or Instances if you are using an older version).
-
In the Databases section on the right, select the read replica or master database instance that you want to connect.
-
In the Connectivity & Security tab, click the hyperlink under Security, VPC security groups.
-
In the Security Groups page, click Create security group.
You can also click on an existing group, which you have used for other database instances, and modify it (or use the Security group selected by Default).
-
In the Create security group page, specify the following:
-
Security group name: An appropriate name for the security group.
-
Description: A brief description of the security group.
-
VPC ID: A unique identifier for the VPC.
2. Add inbound rules
In the Inbound Rules section:
-
Click Add Rule and specify the following:
-
Port range: The port of your Amazon RDS Oracle instance. For example, 1521.
-
Source: Select Custom from the drop-down and enter Hevo’s IP addresses for your region.
-
Click Save rule.
-
Add more rules for all the Hevo IPs you want to allow.
Retrieve the Hostname, Service ID, and Port Number
For configuring the Amazon RDS Oracle Source in Hevo, you must specify the database name, hostname, and port. The hostnames start with your database name and end with rds.amazonaws.com.
For example:
Host: oracle-database-kb.xxxxxxxxx.rds.amazonaws.com
Database name: ORCL
Port: 1521
-
In the left navigation pane of the Amazon RDS console, click Databases (or Instances if you are using an older version).
-
In the Databases section on the right, click the DB identifier of the Amazon RDS Oracle instance.
-
Click the Connectivity & Security tab, and copy the values under Endpoint and Port. Specify these values as the Database Host and Database Port, respectively, while creating your Hevo Pipeline.
-
Click the Configuration tab, and copy the value under DB name. Use this value as the Database Name while creating your Hevo Pipeline.
Specify Amazon RDS Oracle Connection Settings
Perform the following steps to configure your Amazon RDS Oracle Source:
-
Click Sources in the Navigation Bar.
-
Click + Add Source in the Sources List View.
-
On the Add New page, select Amazon RDS Oracle.
-
On the Source Configuration page, do the following:
-
In the Source Name field, specify a unique name for your Source, not exceeding 50 characters. For example, Amazon RDS Oracle Source.
-
In the Connect your Oracle - Log section, specify the following:
-
Database Host: The Oracle database host’s IP address or DNS. For example, oracle-rds-kb.xxxxx.rds.amazonaws.com or 192.168.2.5.
Note: For URL-based hostnames, exclude the http:// or https:// part. For example, if the hostname URL is https://oracle-rds-kb.xxxxx.rds.amazonaws.com, specify oracle-rds-kb.xxxxx.rds.amazonaws.com.
-
Database Port: The port on which your Amazon RDS Oracle server listens for connections. Default value: 1521.
-
Database User: The user who has permission to read tables in your database. For example, hevouser.
-
Database Password: The password of your database user.
-
Database Name: The database from where you want to replicate data. For example, demo.
-
(Optional) In the Additional Settings section, select the following:
-
Use SSH: Enable this option to use an SSH tunnel instead of directly connecting your Amazon RDS Oracle database host to Hevo. This provides an additional level of security to your database by not exposing your Oracle setup to the public. Read Connecting Through SSH.
-
Use SSL: Enable this option to use an SSL-encrypted connection. Specify the following:
-
CA File: The file containing the SSL server certificate authority (CA).
-
Client Certificate: The client’s public key certificate file.
-
Client Key: The client’s private key file.
-
Click Test & Continue.
Read the detailed Hevo documentation for the following related topics:
Data Type Mapping
Hevo maps the Oracle Source data type internally to a unified data type, referred to as the Hevo Data Type, in the table below. This data type is used to represent the Source data from all supported data types in a lossless manner.
The following table lists the supported Oracle data types and the corresponding Hevo data type to which they are mapped:
Oracle Data Type |
Hevo Data Type |
- BIT |
BOOLEAN |
- NUMBER - FLOAT |
DECIMAL |
- BINARY_FLOAT - BINARY_DOUBLE |
FLOAT |
- CHAR - VARCHAR - VARCHAR2 - NCHAR - NVARCHAR - CLOB - NCLOB - ROWID - INTERVAL_DAY_TO_SECOND - INTERVAL_YEAR_TO_MONTH |
VARCHAR |
- TIMESTAMPTZ - TIMESTAMP_LOCALTZ |
TIME_TZ |
- DATE |
DATE |
- TIMESTAMP |
TIME |
- BLOB - RAW |
BYTE_ARRAY |
Read ANSI, DB2, and SQL/DS Data Types to know the data types that Oracle converts from ANSI to its supported ones.
Handling of NUMBER Data Type
In Oracle, NUMBER is a data type that stores fixed or floating-point numbers. To keep a check on the integrity of the input, the NUMBER data type is specified in the format NUMBER(p,s), where s is the scale and p is the precision. Precision (p) refers to the maximum number of significant digits a number can have. Significant digits are the main digits in a number, excluding any leading or trailing zeros. Scale (s) refers to the number of digits to the right of the decimal point. Read Numeric Data Types to know more about how Oracle handles the NUMBER data type.
Non-Positive Scale Handling
In case a negative scale (s < 0) is specified, Oracle rounds the input value by 10^(ABS(scale)). So, the value will not be a floating-point number, but rather a positive integer. For instance, a scale of -2 leads to rounding to the nearest hundred.
Consider the data type NUMBER(10, -2). Suppose you want to store the number 123456.78 in this column, Precision (10) allows for up to 10 total digits, so 123456.78 fits within this limit. With a negative scale (-2), the value is rounded to the nearest hundred. So, 123456.78 would be rounded to 123500 and stored in the column.
Hevo calculates the width of a stored value using the formula, Width = Precision - Scale, which always gives a positive value in case of a negative scale. Width refers to the total number of digits required to store a number, considering both the integer (digits before decimal point) and fractional (digits after decimal point) parts.
The NUMBER data types are mapped to the following Hevo data types based on the calculated width:
Width |
Hevo Data Type |
< 5 |
SHORT |
< 10 |
INT |
< 19 |
LONG |
> 19 |
DECIMAL |
Note: If precision and scale are not defined for the NUMBER datatype, Destination-specific default maximum values for precision and scale are used.
Handling of Unsupported Data Types
If any of the Source objects ingested by Hevo contain unsupported data types, Hevo fails such objects and does not load their data to the Destination.
At this time, the following Oracle data types are not supported by Hevo:
- UROWID
- LONG
- LONG_RAW
- XMLTYPE
- Any other data type not listed in the tables above.
Source Considerations
-
Redo Log does not support user-defined data types. Therefore, fields with such data types are not captured in the log and are lost.
-
The log-mining strategy used in Hevo writes the Oracle data dictionary to redo logs during log switches. This allows Oracle LogMiner to effectively track schema changes but may generate more archive logs and require more database memory, resulting in the LogMiner process taking more time to start after each log switch.
Limitations
- Hevo does not support the flashback method to track incremental updates.