Provision Oracle RDBMS software via RPM

I have always asked myself why Oracle doesn’t package their software as an RPM-surely such a large organisation has the resources to do so!

Well the short answer is they don’t give you an RPM, except for the XE version of the database which prompted me to do it myself. The big problem anyone faces with RPM is that the format doesn’t seem to support files larger than 2GB. Everybody knows that the Oracle database installation is > 2G which requires a little trick on our side. And the trick is not even obscure in any way as I remembered: some time ago I read an interesting article written by Frits Hoogland about cloning Oracle homes. It’s still very relevant and can be found here:

Now that gave me the idea:

  1. You install the oracle binaries on a reference host
  2. Apply any patches and PSUs you need
  3. Wrap the oracle home up in a tar-ball just the way Frits describes by descending into $ORACLE_HOME and creating a tar archive of all files, excluding those ending in “*.log”, network config files in $ORACLE_HOME/network/admin and anything in $ORACLE_HOME/dbs. We don’t want to proliferate our database initialisation files …
  4. You make that tarball available on a central repository and export that with CIFS/NFS or whatever other mechanism you like
  5. Mount this exported file system in /media, so that /media/db11.2.0.3/ has the database.tar.gz file available
  6. Install the RPM

Simple! Piet de Visser would be proud.As it turned out creating (or building) the RPM is the hard part! I have spent a fair amount of time to understand it, and realised that it’s amazing! However IMO RPM is primarly aimed at packaging/building software from the source, something the oracle installer doesn’t really do in the same way.

To get you started, here’s a sample spec file I used, named Oracle11203.spec.

%define name            Oracle11203EE
# package release
%define release         1.0
# vendor release
%define version

Buildroot:              %{_topdir}/BUILDROOT/%{name}-%{release}-rootdir
Summary:                Oracle Database EE
License:                Commercial
Name:                   %{name}
Version:                %{version}
Release:                %{release}
Group:                  Applications/Databases
Vendor:                 Martin Bach Consulting
Requires:               oracle-validated

Oracle Enterprise Edition installation. Requires the binaries
in tar-compressed format in /media/db11.2.0.3/database.tar.gz ready for
cloning. A good source for how to package your system up for cloning can
be found here:

The oracle-validated is used on Oracle Linux 5 to create a sensible installation
environment. Ensure you review the environment before you build oracle!

if [ -d "/u01/app/oracle/product/" ];
then echo "ORACLE_HOME directory exists-aborting";
exit 127

echo "cloning the oracle home now to /u01/app/oracle/product/"
mkdir -p /u01/app/oracle/product/
tar --gzip -xvf /media/db11.2.0.3/database.tar.gz -C /u01/app/oracle/product/
cd /u01/app/oracle/product/
./ ORACLE_HOME="/u01/app/oracle/product/" ORACLE_BASE="/u01/app/oracle" -defaultHomeName


How RPM normally works

When building RPMs, a certain directory structure is assumed, such as a top directory (/home/martin/rpm) and certain subdirectories:

  • RPMS
  • tmp

The RPM build process is controlled via a “SPEC” file. Documentation of these isn’t too great, especially since the format and process has changed over time (see references). The SPEC file follows the process you would normally follow when compiling a piece of software from source. The SPEC file puts more structure around it.

Your source code goes into SOURCES (still tar-compressed). RPM can be instructed to prepare (=uncompress and patch) the tarball, which by default goes into BUILD. When running the configure command, you usually set the prefix to BUILDROOT. After the build completed (using make), you install the package in BUILDROOT. RPM then catalogs the files inside BUILDROOT and uses the defattr() clause in the SPEC file to assign permissions. This is a big relief-in earlier versions of RPM each file that went into the RPM had to be listed under the %files section.

How this process works

The above SPEC skips almost all of these steps. In our example it’s not necessary to download any sources, all the logic is contained in the SPEC file %POST section.In other words, all you need to do to build the RPM is to copy and paste the above code into the Oracle11203EE.spec file. You build the actual RPM using “rpmbuild -ba Oracle11203EE.spec”. At the end, you find a RPM file in the RPMS/x86-64 directory which can from then on be used to install Oracle on any server. And yes, the RPM is empty except for some header information and a few lines of code.

Note that the SPEC file isn’t really complete: add mount commands and error checking as you see fit. You might also want to replace literals with variables etc-the idea was to give the principle away.



5 thoughts on “Provision Oracle RDBMS software via RPM

  1. Pingback: Installer Oracle 12c sur Linux avec un RPM – Partie 1 | ArKZoYd

  2. Pingback: Fast Oracle 12c Installation on Linux with RPMs – Part 1 | ArKZoYd

  3. UX-admin

    What is the point of creating the rpm, if the files cannot be queried? It defeats the entire purpose, which is to be able to plug it into Kickstart, do configuration management, and perform in-place upgrades with rpm -U, not to mention doing rpm -ql … The OS has an empty RPM without any payload in it. The only thing you automated with it is cloning, but you cannot do configuration management (CFengine, Puppet and Chef are not the answer; rpm is).

    1. Martin Bach Post author

      The point is that you can run a single command to deploy an Oracle database on Linux. A similar process can be implemented on all major UNIX platforms, I did it for AIX and Solaris/SPARC. Instead of an Oracle DBA (who doesn’t have root access) a system administrator can deploy the package. It is 100% consistent, every deployment is the same, the version can be queried in the RPM database, although-as you correctly said-you can’t see the package contents. But since you agreed by means of a corporate standard where the binaries are going to be, you know where the files are.

      I have researched the topic exhaustively and came to the conclusion that RPM is not made for the likes of Oracle, it is designed for smaller software packages. AFAIK there is a size limitation in RPM of 2 GB that makes an Oracle deployment following the spirit of RPM impossible. Regarding the other questions: I deploy Oracle using kickstart in the way described in the article. Regarding in-place upgrades: although possible for the RDBMS without Grid Infrastructure they are not a good idea with Oracle. I am not sure I understand what you mean by “configuration management”, can you elaborate?

Comments are closed.