Oracle XE 11.2. and MariaDB 10.1 integration on Ubuntu 14.04 and Debian systems

Migrate from Oracle to MariaDB Server. This page provides detailed guidance, tools, and best practices for a smooth and efficient transition of your databases and applications.

Part 1: Installing Oracle Database Express Edition (XE)

This section covers the installation of Java and the Oracle XE database on a Debian-based system like Ubuntu.

Step 1: Download Oracle Database XE

  1. Sign up for an Oracle account (if you don't have one) and log in.

  2. Navigate to the download page for legacy versions of the database. A good starting point is the Oracle Database Express Edition (XE) 11gR2 Archive Downloads Page.

  3. Accept the license agreement.

  4. Download Oracle Database Express Edition 11g Release 2 for Linux x64. The file will be named similarly to oracle-xe-11.2.0-1.0.x86_64.rpm.zip.

Step 2: Install and Configure Java 8

Oracle XE 11gR2 requires a Java environment.

A) Add the Java PPA and Install

sudo add-apt-repository ppa:webupd8team/java
# Press Enter to accept when prompted
sudo apt-get update
sudo apt-get install oracle-java8-installer

B) Verify Java Installation

After the installation completes, verify the version.

java -version

The output should be similar to:

C) Set JAVA_HOME Environment Variable

Edit the system-wide bash configuration file.

Scroll to the bottom of the file and add the following lines:

Save the file and exit. Then, source the file to apply the changes and verify the variable is set.

The output should be:

Step 3: Install Prerequisite Packages

Additional packages are required to convert and install the Oracle RPM.

Step 4: Convert the Oracle RPM to a DEB Package

The downloaded file is an RPM, which must be converted to a DEB package for Debian-based systems.

This conversion step might take some time. You can proceed with the following configuration steps in a separate terminal window while it runs.

Step 5: Create chkconfig and Kernel Configuration

A) Create a chkconfig Compatibility Script

The Oracle installer expects the chkconfig utility, which doesn't exist on Debian-based systems. Create a compatibility script.

Add the following content to the new file:

Save the file, then make it executable:

B) Configure Kernel Parameters

Create a configuration file for Oracle-specific kernel parameters.

Copy and paste the following into the file. The value for kernel.shmmax should be approximately half of your system's physical RAM, specified in bytes (e.g., 512MB = 536870912 bytes).

Apply the new kernel parameters and verify the fs.file-max setting.

The expected output is 6815744.

Step 6: Final System Adjustments

A) Create Compatibility Links and Directories

B) Configure Shared Memory (/dev/shm)

To avoid a potential ORA-00845: MEMORY_TARGET error, re-mount the /dev/shm directory with a sufficient size. Replace 4096m with the amount of RAM on your machine.

To make this change persistent across reboots, create a startup script.

Add the following content, again replacing 4096m with your machine's RAM size.

Save the file and make it executable:

Step 7: Install and Configure Oracle XE

A) Install the Converted Package

By now, the .deb package should have been created. Install it using \.

B) Run the Oracle Configuration Script

Configure the database by running the script and answering the prompts. The default answers are usually acceptable.

You will be prompted for:

  • HTTP port for Oracle Application Express (default: 8080)

  • Database listener port (default: 1521)

  • A password for the SYS and SYSTEM accounts.

  • Whether to start the database on boot (default: y)

C) Set Oracle Environment Variables

Edit /etc/bash.bashrc again to add the Oracle-specific variables.

Add the following to the end of the file:

Apply and verify the changes:

D) Start Oracle

Part 2: Installing SQL Developer

Step 1: Download and Install SQL Developer

  1. Go to the Oracle site and download the Linux RPM package for Oracle SQL Developer.

  2. Use alien to convert the package and dpkg to install it.

  1. Create a configuration directory.

Step 2: Run and Connect to Oracle XE

  1. Launch SQL Developer.

    Bash

  2. If it asks for the Java path, provide it: /usr/lib/jvm/java-8-oracle.

  3. Inside SQL Developer, create a new connection with the following details:

    • Click: Connections, then Add new connection

    • Connection Name: XE

    • Username: SYSTEM

    • Password: <your-password>

    • Connection Type: Basic, Role: Default

    • Hostname: localhost

    • Port: 1521

    • SID: xe

Part 3: Installing MariaDB and Connecting to Oracle

Step 1: Install MariaDB

Follow the official instructions on the MariaDB website for your specific OS version.

Step 2: Install MariaDB ODBC Connector

  1. Download the "MariaDB Connector/ODBC" for Linux from the MariaDB website.

  2. Extract the archive and copy the library file.

Step 3: Install UnixODBC and CONNECT Engine

Step 4: Configure ODBC Drivers

A) Configure the Oracle Driver

Edit /etc/odbcinst.ini and add the following section:

B) Configure the Oracle DSN

Edit /etc/odbc.ini and add a Data Source Name (DSN) for your Oracle XE database.

Step 5: Test the Oracle ODBC Connection

Use isql to test the connection and create a sample table in Oracle.

You should see the rows 1, 3, 5, 8 returned.

Step 6: Configure and Test the MariaDB CONNECT Engine

A) Set Environment Variables for MariaDB

For the CONNECT engine to find the Oracle libraries, you must add the Oracle environment variables to MariaDB's startup script. Edit /etc/init.d/mysql.

Immediately after ### END INIT INFO, add the following block:

B) Restart MariaDB and Test the Connection

Once logged into the MariaDB client, run the following SQL commands:

You should see the values 1, 3, 5, 8 retrieved from the Oracle table.

Part 4: Connecting to MariaDB via JDBC

Step 1: Install the MariaDB JDBC Driver

  1. Download the "MySQL Connector/J" from the MySQL or MariaDB website.

  2. Extract the archive and copy the .jar file to a known location.

Step 2: Configure SQL Developer

  1. Launch SQL Developer: sudo /opt/sqldeveloper/sqldeveloper.sh

  2. Go to Tools -> Preferences.

  3. Expand Database and click on Third Party JDBC Drivers.

  4. Click Add Entry... and navigate to the .jar file you copied: /usr/lib/jvm/java-8-oracle/lib/mariadb/mysql-connector-java-5.0.8-bin.jar.

  5. Click OK to close the preferences.

Step 3: Connect to MariaDB

  1. In SQL Developer, create a new connection.

  2. Switch to the MySQL tab.

  3. Enter the connection details:

    • Connection Name: MariaDB via MySQL Conn

    • Username: root

    • Password: <your-root-password>

    • Hostname: localhost

    • Port: 3306

  4. Click Test Connection. It should report Status: Success.

  5. Save and connect. You can now run queries against your MariaDB server in the worksheet.


This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?