Install GDAL on Oracle Linux (OL7 & OL8)
GDAL (http://gdal.org) provides an open-source library that offers a uniform API for accessing any type of geospatial data, in any format or repository, whether they are files or databases. Its architecture closely resembles that of JDBC, featuring an API, a core component, and a collection of “plugins” or “drivers” designed to support various formats. While this is primarily implemented in C/C++, it also offers language bindings for Java and Python. GDAL finds extensive utilization in both open-source and commercial software solutions. At Oracle, we strongly recommend the utilization of GDAL for importing spatial data into the database and for exporting it from the database. We have also taken the responsibility of developing and maintaining plugins specifically for the Oracle database.
Numerous public sites offer pre-built GDAL packages, but only a handful of them include the Oracle plugins, primarily due to their reliance on specific libraries. This issue extends to several data formats that are dependent on non-open-source libraries.
The GDAL package itself comprises two sub-packages:
- OGR: This sub-package is responsible for handling “vector” data, such as shapefiles.
- GDAL (proper): This sub-package is designed for managing “raster” data, which includes data types like satellite imagery.
Download GDAL
You should download the utility as patches from Oracle support. Below are the patch details along with the download link.
Patch GDAL version OS DB Client Download link
-------- ------------ ------- --------- -------------------------------------------------
34816367 3.4.1 OL7 19.1 https://updates.oracle.com/download/34816367.html
35374861 3.4.1 OL8 19.1 https://updates.oracle.com/download/35374861.html
Once you download the patch mentioned above, you will find two files: one for Linux and another for Windows. You have the option to select which one to install. In this case, we will opt for Linux.
Installation of software.
You can install the patch anywhere, but we recommend installing it in ORACLE_HOME. In my case, it is located at “/var/opt/oracle/product/dbhome”. If you don’t have Oracle 19c installed, then download and install Oracle binaries from here
sudo mkdir /var/opt/oracle/product/dbhome/gdal
sudo unzip gdal341_linux64.zip -d /var/opt/oracle/product/dbhome/gdal
sudo mv /var/opt/oracle/product/dbhome/gdal/gdal /var/opt/oracle/product/dbhome/gdal/gdal3.4.1
Here is the result:
$ ls -l /var/opt/oracle/product/dbhome/gdal/gdal3.4.1
total 52
drwxr-xr-x 2 root root 4096 Oct 14 12:17 bin
drwxr-xr-x 2 root root 4096 Oct 14 12:17 data
drwxr-xr-x 2 root root 4096 Oct 14 12:17 include
drwxr-xr-x 4 root root 4096 Nov 29 01:44 lib
-rw-rw-r-- 1 root root 22739 Oct 14 12:17 LICENSE.TXT
drwxrwxr-x 3 root root 27 Oct 14 12:17 python
-rwxrwxr-x 1 root root 3142 Oct 14 12:17 README.TXT
-rwxr-xr-x 1 root root 1361 Oct 14 12:17 setup_gdal.conf
-r-xr-xr-x 1 root root 1741 Oct 14 12:17 setup_hdfs_gdal.conf
Setup the environment.
Put the relevant entries of the environment path in bash profile.
In ~/.bash_profile
Enter the below lines with the database environment files.
export PATH=$GDAL_HOME/bin:$PATH
export GDAL_DATA=$GDAL_HOME/data
export LD_LIBRARY_PATH=$GDAL_HOME/lib:$LD_LIBRARY_PATH
export GDAL_DRIVER_PATH=$GDAL_HOME/lib/gdalplugins
export PROJ_LIB=$GDAL_HOME/lib
update the extproc.ora file which is located in "$ORACLE_HOME/hs/admin/extproc.ora"
set EXTPROC_DLLS=<ORACLE_HOME>/md/lib/libsdogdal.so
set GDAL_DATA=<ORACLE_HOME>/md/gdal/data
set GDAL_DRIVER_PATH=<ORACLE_HOME>/md/gdal/lib/gdalplugins
set EXTPROC_DLLS=ANY
Create a symbolic link to the GDAL main library
ln -s ${ORACLE_HOME}/md/gdal/lib/libgdal.so ${ORACLE_HOME}/lib/libgdal.so
$ ogrinfo --version
GDAL 3.4.1, released 2021/12/27